summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/fast-isel-constpool.ll
blob: 4b6092c5bf2b5f8d08e19fb23940275544e0fdbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; 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
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx < %s | FileCheck %s --check-prefix=AVX
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx < %s | FileCheck %s --check-prefix=LARGE_AVX
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx512f < %s | FileCheck %s --check-prefix=AVX
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large -mattr=avx512f < %s | FileCheck %s --check-prefix=LARGE_AVX

; Make sure fast isel uses rip-relative addressing for the small code model.
define float @constpool_float(float %x) {
; CHECK-LABEL: constpool_float:
; CHECK:       ## %bb.0:
; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
; CHECK-NEXT:    addss %xmm1, %xmm0
; CHECK-NEXT:    retq
;
; LARGE-LABEL: constpool_float:
; LARGE:       ## %bb.0:
; LARGE-NEXT:  Ltmp0:
; LARGE-NEXT:    leaq {{.*}}(%rip), %rax
; LARGE-NEXT:    movabsq $__GLOBAL_OFFSET_TABLE_-Ltmp0, %rcx
; LARGE-NEXT:    addq %rcx, %rax
; LARGE-NEXT:    movabsq $LCPI0_0@GOTOFF, %rax
; LARGE-NEXT:    addss (%rax), %xmm0
; LARGE-NEXT:    retq
;
; AVX-LABEL: constpool_float:
; AVX:       ## %bb.0:
; AVX-NEXT:    vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
; AVX-NEXT:    vaddss %xmm1, %xmm0, %xmm0
; AVX-NEXT:    retq
;
; LARGE_AVX-LABEL: constpool_float:
; LARGE_AVX:       ## %bb.0:
; LARGE_AVX-NEXT:  Ltmp0:
; LARGE_AVX-NEXT:    leaq {{.*}}(%rip), %rax
; LARGE_AVX-NEXT:    movabsq $__GLOBAL_OFFSET_TABLE_-Ltmp0, %rcx
; LARGE_AVX-NEXT:    addq %rcx, %rax
; LARGE_AVX-NEXT:    movabsq $LCPI0_0@GOTOFF, %rax
; LARGE_AVX-NEXT:    vaddss (%rax), %xmm0, %xmm0
; LARGE_AVX-NEXT:    retq

  %1 = fadd float %x, 16.50e+01
  ret float %1
}

define double @constpool_double(double %x) nounwind {
; CHECK-LABEL: constpool_double:
; CHECK:       ## %bb.0:
; CHECK-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
; CHECK-NEXT:    addsd %xmm1, %xmm0
; CHECK-NEXT:    retq
;
; LARGE-LABEL: constpool_double:
; LARGE:       ## %bb.0:
; LARGE-NEXT:  Ltmp1:
; LARGE-NEXT:    leaq {{.*}}(%rip), %rax
; LARGE-NEXT:    movabsq $__GLOBAL_OFFSET_TABLE_-Ltmp1, %rcx
; LARGE-NEXT:    addq %rcx, %rax
; LARGE-NEXT:    movabsq $LCPI1_0@GOTOFF, %rax
; LARGE-NEXT:    addsd (%rax), %xmm0
; LARGE-NEXT:    retq
;
; AVX-LABEL: constpool_double:
; AVX:       ## %bb.0:
; AVX-NEXT:    vmovsd {{.*#+}} xmm1 = mem[0],zero
; AVX-NEXT:    vaddsd %xmm1, %xmm0, %xmm0
; AVX-NEXT:    retq
;
; LARGE_AVX-LABEL: constpool_double:
; LARGE_AVX:       ## %bb.0:
; LARGE_AVX-NEXT:  Ltmp1:
; LARGE_AVX-NEXT:    leaq {{.*}}(%rip), %rax
; LARGE_AVX-NEXT:    movabsq $__GLOBAL_OFFSET_TABLE_-Ltmp1, %rcx
; LARGE_AVX-NEXT:    addq %rcx, %rax
; LARGE_AVX-NEXT:    movabsq $LCPI1_0@GOTOFF, %rax
; LARGE_AVX-NEXT:    vaddsd (%rax), %xmm0, %xmm0
; LARGE_AVX-NEXT:    retq

  %1 = fadd double %x, 8.500000e-01
  ret double %1
}
OpenPOWER on IntegriCloud