1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small < %s | FileCheck %s
3; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large < %s | FileCheck %s --check-prefix=LARGE
4; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx < %s | FileCheck %s --check-prefix=AVX
5; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx < %s | FileCheck %s --check-prefix=LARGE_AVX
6; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx512f < %s | FileCheck %s --check-prefix=AVX
7; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx512f < %s | FileCheck %s --check-prefix=LARGE_AVX
8
9; Make sure fast isel uses rip-relative addressing for the small code model.
10define float @constpool_float(float %x) {
11; CHECK-LABEL: constpool_float:
12; CHECK:       ## BB#0:
13; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
14; CHECK-NEXT:    addss %xmm1, %xmm0
15; CHECK-NEXT:    retq
16;
17; LARGE-LABEL: constpool_float:
18; LARGE:       ## BB#0:
19; LARGE-NEXT:    movabsq $LCPI0_0, %rax
20; LARGE-NEXT:    addss (%rax), %xmm0
21; LARGE-NEXT:    retq
22;
23; AVX-LABEL: constpool_float:
24; AVX:       ## BB#0:
25; AVX-NEXT:    vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
26; AVX-NEXT:    vaddss %xmm1, %xmm0, %xmm0
27; AVX-NEXT:    retq
28;
29; LARGE_AVX-LABEL: constpool_float:
30; LARGE_AVX:       ## BB#0:
31; LARGE_AVX-NEXT:    movabsq $LCPI0_0, %rax
32; LARGE_AVX-NEXT:    vaddss (%rax), %xmm0, %xmm0
33; LARGE_AVX-NEXT:    retq
34
35  %1 = fadd float %x, 16.50e+01
36  ret float %1
37}
38
39define double @constpool_double(double %x) nounwind {
40; CHECK-LABEL: constpool_double:
41; CHECK:       ## BB#0:
42; CHECK-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
43; CHECK-NEXT:    addsd %xmm1, %xmm0
44; CHECK-NEXT:    retq
45;
46; LARGE-LABEL: constpool_double:
47; LARGE:       ## BB#0:
48; LARGE-NEXT:    movabsq $LCPI1_0, %rax
49; LARGE-NEXT:    addsd (%rax), %xmm0
50; LARGE-NEXT:    retq
51;
52; AVX-LABEL: constpool_double:
53; AVX:       ## BB#0:
54; AVX-NEXT:    vmovsd {{.*#+}} xmm1 = mem[0],zero
55; AVX-NEXT:    vaddsd %xmm1, %xmm0, %xmm0
56; AVX-NEXT:    retq
57;
58; LARGE_AVX-LABEL: constpool_double:
59; LARGE_AVX:       ## BB#0:
60; LARGE_AVX-NEXT:    movabsq $LCPI1_0, %rax
61; LARGE_AVX-NEXT:    vaddsd (%rax), %xmm0, %xmm0
62; LARGE_AVX-NEXT:    retq
63
64  %1 = fadd double %x, 8.500000e-01
65  ret double %1
66}
67