llvm-6502/test/CodeGen/X86/fast-isel-constpool.ll
Juergen Ributzka 96b1e70c66 Reapply [FastISel][X86] Add large code model support for materializing floating-point constants (r215595).
Note: This was originally reverted to track down a buildbot error. Reapply
without any modifications.

Original commit message:
In the large code model for X86 floating-point constants are placed in the
constant pool and materialized by loading from it. Since the constant pool
could be far away, a PC relative load might not work. Therefore we first
materialize the address of the constant pool with a movabsq and then load
from there the floating-point value.

Fixes <rdar://problem/17674628>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216012 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 19:44:13 +00:00

24 lines
741 B
LLVM

; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small < %s | FileCheck %s
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large < %s | FileCheck %s --check-prefix=LARGE
; Make sure fast isel uses rip-relative addressing for the small code model.
define float @constpool_float(float %x) {
; CHECK-LABEL: constpool_float
; CHECK: LCPI0_0(%rip)
; LARGE-LABEL: constpool_float
; LARGE: movabsq $LCPI0_0, %rax
%1 = fadd float %x, 16.50e+01
ret float %1
}
define double @constpool_double(double %x) nounwind {
; CHECK-LABEL: constpool_double
; CHECK: LCPI1_0(%rip)
; LARGE-LABEL: constpool_double
; LARGE: movabsq $LCPI1_0, %rax
%1 = fadd double %x, 8.500000e-01
ret double %1
}