1# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2# This test ensures that the MIR parser parses constant pool constants and
3# constant pool operands correctly.
4
5--- |
6
7  define double @test(double %a, float %b) {
8  entry:
9    %c = fadd double %a, 3.250000e+00
10    %d = fadd float %b, 6.250000e+00
11    %e = fpext float %d to double
12    %f = fmul double %c, %e
13    ret double %f
14  }
15
16  define double @test2(double %a, float %b) {
17  entry:
18    %c = fadd double %a, 3.250000e+00
19    %d = fadd float %b, 6.250000e+00
20    %e = fpext float %d to double
21    %f = fmul double %c, %e
22    ret double %f
23  }
24
25  define double @test3(double %a, float %b) {
26  entry:
27    %c = fadd double %a, 3.250000e+00
28    %d = fadd float %b, 6.250000e+00
29    %e = fpext float %d to double
30    %f = fmul double %c, %e
31    ret double %f
32  }
33
34  define double @test4(double %a, float %b) {
35  entry:
36    %c = fadd double %a, 3.250000e+00
37    %d = fadd float %b, 6.250000e+00
38    %e = fpext float %d to double
39    %f = fmul double %c, %e
40    ret double %f
41  }
42...
43---
44# CHECK: name: test
45# CHECK: constants:
46# CHECK-NEXT: - id: 0
47# CHECK-NEXT:   value: 'double 3.250000e+00'
48# CHECK-NEXT:   alignment: 8
49# CHECK-NEXT: - id: 1
50# CHECK-NEXT:   value: 'float 6.250000e+00'
51# CHECK-NEXT:   alignment: 4
52name:            test
53constants:
54  - id:          0
55    value:       'double 3.250000e+00'
56    alignment:   8
57  - id:          1
58    value:       'float 6.250000e+00'
59    alignment:   4
60body: |
61  bb.0.entry:
62    ; CHECK:      %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _
63    ; CHECK-NEXT: %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.1, _
64    %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _
65    %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.1, _
66    %xmm1 = CVTSS2SDrr killed %xmm1
67    %xmm0 = MULSDrr killed %xmm0, killed %xmm1
68    RETQ %xmm0
69...
70---
71# Verify that alignment can be inferred:
72# CHECK: name: test2
73# CHECK: constants:
74# CHECK-NEXT: - id: 0
75# CHECK-NEXT:   value: 'double 3.250000e+00'
76# CHECK-NEXT:   alignment: 8
77# CHECK-NEXT: - id: 1
78# CHECK-NEXT:   value: 'float 6.250000e+00'
79# CHECK-NEXT:   alignment: 4
80name:            test2
81constants:
82  - id:          0
83    value:       'double 3.250000e+00'
84  - id:          1
85    value:       'float 6.250000e+00'
86body: |
87  bb.0.entry:
88    %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _
89    %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.1, _
90    %xmm1 = CVTSS2SDrr killed %xmm1
91    %xmm0 = MULSDrr killed %xmm0, killed %xmm1
92    RETQ %xmm0
93...
94---
95# Verify that the non-standard alignments are respected:
96# CHECK: name: test3
97# CHECK: constants:
98# CHECK-NEXT: - id: 0
99# CHECK-NEXT:   value: 'double 3.250000e+00'
100# CHECK-NEXT:   alignment: 128
101# CHECK-NEXT: - id: 1
102# CHECK-NEXT:   value: 'float 6.250000e+00'
103# CHECK-NEXT:   alignment: 1
104name:            test3
105constants:
106  - id:          0
107    value:       'double 3.250000e+00'
108    alignment:   128
109  - id:          1
110    value:       'float 6.250000e+00'
111    alignment:   1
112body: |
113  bb.0.entry:
114    ; CHECK:      %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _
115    ; CHECK-NEXT: %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.1, _
116    %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _
117    %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.1, _
118    %xmm1 = CVTSS2SDrr killed %xmm1
119    %xmm0 = MULSDrr killed %xmm0, killed %xmm1
120    RETQ %xmm0
121...
122---
123# CHECK:  name:  test4
124name:            test4
125constants:
126  - id:          0
127    value:       'double 3.250000e+00'
128  - id:          1
129    value:       'float 6.250000e+00'
130body: |
131  bb.0.entry:
132    ; CHECK:      %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.1 - 12, _
133    ; CHECK-NEXT: %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.0 + 8, _
134    %xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.1 - 12, _
135    %xmm1 = ADDSSrm killed %xmm1, %rip, 1, _, %const.0 + 8, _
136    %xmm1 = CVTSS2SDrr killed %xmm1
137    %xmm0 = MULSDrr killed %xmm0, killed %xmm1
138    RETQ %xmm0
139...
140