1# RUN: llc -march=x86-64 -run-pass none -o - %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:   isTargetSpecific: false
50# CHECK-NEXT: - id: 1
51# CHECK-NEXT:   value: 'float 6.250000e+00'
52# CHECK-NEXT:   alignment: 4
53# CHECK-NEXT:   isTargetSpecific: false
54name:            test
55constants:
56  - id:          0
57    value:       'double 3.250000e+00'
58    alignment:   8
59  - id:          1
60    value:       'float 6.250000e+00'
61    alignment:   4
62body: |
63  bb.0.entry:
64    ; CHECK:      $xmm0 = ADDSDrm killed $xmm0, $rip, 1, $noreg, %const.0, $noreg, implicit $mxcsr
65    ; CHECK-NEXT: $xmm1 = ADDSSrm killed $xmm1, $rip, 1, $noreg, %const.1, $noreg, implicit $mxcsr
66    $xmm0 = ADDSDrm killed $xmm0, $rip, 1, _, %const.0, _, implicit $mxcsr
67    $xmm1 = ADDSSrm killed $xmm1, $rip, 1, _, %const.1, _, implicit $mxcsr
68    $xmm1 = CVTSS2SDrr killed $xmm1, implicit $mxcsr
69    $xmm0 = MULSDrr killed $xmm0, killed $xmm1, implicit $mxcsr
70    RETQ $xmm0
71...
72---
73# Verify that alignment can be inferred:
74# CHECK: name: test2
75# CHECK: constants:
76# CHECK-NEXT: - id: 0
77# CHECK-NEXT:   value: 'double 3.250000e+00'
78# CHECK-NEXT:   alignment: 8
79# CHECK-NEXT:   isTargetSpecific: false
80# CHECK-NEXT: - id: 1
81# CHECK-NEXT:   value: 'float 6.250000e+00'
82# CHECK-NEXT:   alignment: 4
83# CHECK-NEXT:   isTargetSpecific: false
84name:            test2
85constants:
86  - id:          0
87    value:       'double 3.250000e+00'
88  - id:          1
89    value:       'float 6.250000e+00'
90body: |
91  bb.0.entry:
92    $xmm0 = ADDSDrm killed $xmm0, $rip, 1, _, %const.0, _, implicit $mxcsr
93    $xmm1 = ADDSSrm killed $xmm1, $rip, 1, _, %const.1, _, implicit $mxcsr
94    $xmm1 = CVTSS2SDrr killed $xmm1, implicit $mxcsr
95    $xmm0 = MULSDrr killed $xmm0, killed $xmm1, implicit $mxcsr
96    RETQ $xmm0
97...
98---
99# Verify that the non-standard alignments are respected:
100# CHECK: name: test3
101# CHECK: constants:
102# CHECK-NEXT: - id: 0
103# CHECK-NEXT:   value: 'double 3.250000e+00'
104# CHECK-NEXT:   alignment: 128
105# CHECK-NEXT:   isTargetSpecific: false
106# CHECK-NEXT: - id: 1
107# CHECK-NEXT:   value: 'float 6.250000e+00'
108# CHECK-NEXT:   alignment: 1
109# CHECK-NEXT:   isTargetSpecific: false
110name:            test3
111constants:
112  - id:          0
113    value:       'double 3.250000e+00'
114    alignment:   128
115  - id:          1
116    value:       'float 6.250000e+00'
117    alignment:   1
118body: |
119  bb.0.entry:
120    ; CHECK:      $xmm0 = ADDSDrm killed $xmm0, $rip, 1, $noreg, %const.0, $noreg, implicit $mxcsr
121    ; CHECK-NEXT: $xmm1 = ADDSSrm killed $xmm1, $rip, 1, $noreg, %const.1, $noreg, implicit $mxcsr
122    $xmm0 = ADDSDrm killed $xmm0, $rip, 1, _, %const.0, _, implicit $mxcsr
123    $xmm1 = ADDSSrm killed $xmm1, $rip, 1, _, %const.1, _, implicit $mxcsr
124    $xmm1 = CVTSS2SDrr killed $xmm1, implicit $mxcsr
125    $xmm0 = MULSDrr killed $xmm0, killed $xmm1, implicit $mxcsr
126    RETQ $xmm0
127...
128---
129# CHECK:  name:  test4
130name:            test4
131constants:
132  - id:          0
133    value:       'double 3.250000e+00'
134  - id:          1
135    value:       'float 6.250000e+00'
136body: |
137  bb.0.entry:
138    ; CHECK:      $xmm0 = ADDSDrm killed $xmm0, $rip, 1, $noreg, %const.1 - 12, $noreg, implicit $mxcsr
139    ; CHECK-NEXT: $xmm1 = ADDSSrm killed $xmm1, $rip, 1, $noreg, %const.0 + 8, $noreg, implicit $mxcsr
140    $xmm0 = ADDSDrm killed $xmm0, $rip, 1, _, %const.1 - 12, _, implicit $mxcsr
141    $xmm1 = ADDSSrm killed $xmm1, $rip, 1, _, %const.0 + 8, _, implicit $mxcsr
142    $xmm1 = CVTSS2SDrr killed $xmm1, implicit $mxcsr
143    $xmm0 = MULSDrr killed $xmm0, killed $xmm1, implicit $mxcsr
144    RETQ $xmm0
145...
146