2013-01-11 10:36:13 +00:00
|
|
|
; RUN: llc -mtriple=x86_64-none-linux < %s | FileCheck %s
|
|
|
|
|
|
|
|
; Check that all current floating-point types are correctly emitted to assembly
|
|
|
|
; on a little-endian target.
|
|
|
|
|
|
|
|
@var128 = global fp128 0xL00000000000000008000000000000000, align 16
|
|
|
|
@varppc128 = global ppc_fp128 0xM80000000000000000000000000000000, align 16
|
|
|
|
@var80 = global x86_fp80 0xK80000000000000000000, align 16
|
|
|
|
@var64 = global double -0.0, align 8
|
|
|
|
@var32 = global float -0.0, align 4
|
|
|
|
@var16 = global half -0.0, align 2
|
|
|
|
|
|
|
|
; CHECK: var128:
|
|
|
|
; CHECK-NEXT: .quad 0 # fp128 -0
|
|
|
|
; CHECK-NEXT: .quad -9223372036854775808
|
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|
|
|
|
; CHECK: varppc128:
|
Fix ppcf128 component access on little-endian systems
The PowerPC 128-bit long double data type (ppcf128 in LLVM) is in fact a
pair of two doubles, where one is considered the "high" or
more-significant part, and the other is considered the "low" or
less-significant part. When a ppcf128 value is stored in memory or a
register pair, the high part always comes first, i.e. at the lower
memory address or in the lower-numbered register, and the low part
always comes second. This is true both on big-endian and little-endian
PowerPC systems. (Similar to how with a complex number, the real part
always comes first and the imaginary part second, no matter the byte
order of the system.)
This was implemented incorrectly for little-endian systems in LLVM.
This commit fixes three related issues:
- When printing an immediate ppcf128 constant to assembler output
in emitGlobalConstantFP, emit the high part first on both big-
and little-endian systems.
- When lowering a ppcf128 type to a pair of f64 types in SelectionDAG
(which is used e.g. when generating code to load an argument into a
register pair), use correct low/high part ordering on little-endian
systems.
- In a related issue, because lowering ppcf128 into a pair of f64 must
operate differently from lowering an int128 into a pair of i64,
bitcasts between ppcf128 and int128 must not be optimized away by the
DAG combiner on little-endian systems, but must effect a word-swap.
Reviewed by Hal Finkel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212274 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-03 15:06:47 +00:00
|
|
|
; For ppc_fp128, the high double always comes first.
|
|
|
|
; CHECK-NEXT: .quad -9223372036854775808 # ppc_fp128 -0
|
|
|
|
; CHECK-NEXT: .quad 0
|
2013-01-11 10:36:13 +00:00
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|
|
|
|
; CHECK: var80:
|
|
|
|
; CHECK-NEXT: .quad 0 # x86_fp80 -0
|
|
|
|
; CHECK-NEXT: .short 32768
|
|
|
|
; CHECK-NEXT: .zero 6
|
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|
|
|
|
; CHECK: var64:
|
|
|
|
; CHECK-NEXT: .quad -9223372036854775808 # double -0
|
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|
|
|
|
; CHECK: var32:
|
|
|
|
; CHECK-NEXT: .long 2147483648 # float -0
|
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|
|
|
|
; CHECK: var16:
|
|
|
|
; CHECK-NEXT: .short 32768 # half -0
|
|
|
|
; CHECK-NEXT: .size
|
|
|
|
|