arm-legalize-vfp4.mir
4.96 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# RUN: llc -mtriple arm-linux-gnueabihf -mattr=+vfp4 -float-abi=hard -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix HARD
# RUN: llc -mtriple arm-linux-gnueabihf -mattr=+vfp2 -float-abi=hard -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT -check-prefix HARD-ABI
# RUN: llc -mtriple arm-linux-gnueabi -mattr=+vfp4,+soft-float -float-abi=soft -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT -check-prefix SOFT-ABI
# RUN: llc -mtriple arm-linux-gnu -mattr=+vfp4,+soft-float -float-abi=soft -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT -check-prefix SOFT-ABI
--- |
define void @test_fma_float() { ret void }
define void @test_fma_double() { ret void }
...
---
name: test_fma_float
# CHECK-LABEL: name: test_fma_float
legalized: false
# CHECK: legalized: true
regBankSelected: false
selected: false
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
body: |
bb.0:
liveins: $r0, $r1, $r2
; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0
; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1
; CHECK-DAG: [[Z:%[0-9]+]]:_(s32) = COPY $r2
%0(s32) = COPY $r0
%1(s32) = COPY $r1
%2(s32) = COPY $r2
; HARD: [[R:%[0-9]+]]:_(s32) = G_FMA [[X]], [[Y]], [[Z]]
; SOFT-NOT: G_FMA
; SOFT: ADJCALLSTACKDOWN
; SOFT-ABI-DAG: $r0 = COPY [[X]]
; SOFT-ABI-DAG: $r1 = COPY [[Y]]
; SOFT-ABI-DAG: $r2 = COPY [[Z]]
; SOFT-ABI: BL &fmaf, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit-def $r0
; SOFT-ABI: [[R:%[0-9]+]]:_(s32) = COPY $r0
; HARD-ABI-DAG: $s0 = COPY [[X]]
; HARD-ABI-DAG: $s1 = COPY [[Y]]
; HARD-ABI-DAG: $s2 = COPY [[Z]]
; HARD-ABI: BL &fmaf, {{.*}}, implicit $s0, implicit $s1, implicit $s2, implicit-def $s0
; HARD-ABI: [[R:%[0-9]+]]:_(s32) = COPY $s0
; SOFT: ADJCALLSTACKUP
; SOFT-NOT: G_FMA
%3(s32) = G_FMA %0, %1, %2
; CHECK: $r0 = COPY [[R]]
$r0 = COPY %3(s32)
BX_RET 14, $noreg, implicit $r0
...
---
name: test_fma_double
# CHECK-LABEL: name: test_fma_double
legalized: false
# CHECK: legalized: true
regBankSelected: false
selected: false
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
- { id: 4, class: _ }
- { id: 5, class: _ }
- { id: 6, class: _ }
- { id: 7, class: _ }
- { id: 8, class: _ }
body: |
bb.0:
liveins: $r0, $r1, $r2, $r3
; CHECK-DAG: [[X0:%[0-9]+]]:_(s32) = COPY $r0
; CHECK-DAG: [[X1:%[0-9]+]]:_(s32) = COPY $r1
; CHECK-DAG: [[Y0:%[0-9]+]]:_(s32) = COPY $r2
; CHECK-DAG: [[Y1:%[0-9]+]]:_(s32) = COPY $r3
%0(s32) = COPY $r0
%1(s32) = COPY $r1
%2(s32) = COPY $r2
%3(s32) = COPY $r3
; HARD-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
; HARD-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
; HARD-ABI-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
; HARD-ABI-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
%4(s64) = G_MERGE_VALUES %0(s32), %1(s32)
%5(s64) = G_MERGE_VALUES %2(s32), %3(s32)
; HARD: [[R:%[0-9]+]]:_(s64) = G_FMA [[X]], [[X]], [[Y]]
; SOFT-NOT: G_FMA
; SOFT: ADJCALLSTACKDOWN
; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X0]]
; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X1]]
; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X0]]
; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X1]]
; SOFT-ABI: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
; SOFT-ABI: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
; SOFT-ABI: [[FI1:%[0-9]+]]:_(p0) = G_PTR_ADD [[SP1]], [[OFF1]](s32)
; FIXME: This ought to be align 8 but ARM's call lowering hardcodes it to 1
; SOFT-ABI: G_STORE [[Y0]](s32), [[FI1]](p0){{.*}}store 4 into stack, align 1)
; SOFT-ABI: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
; SOFT-ABI: [[FI2:%[0-9]+]]:_(p0) = G_PTR_ADD [[FI1]], [[OFF2]](s32)
; SOFT-ABI: G_STORE [[Y1]](s32), [[FI2]](p0){{.*}}store 4 into stack + 4, align 1)
; SOFT-ABI: BL &fma, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
; SOFT-ABI-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0
; SOFT-ABI-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1
; HARD-ABI-DAG: $d0 = COPY [[X]]
; HARD-ABI-DAG: $d1 = COPY [[X]]
; HARD-ABI-DAG: $d2 = COPY [[Y]]
; HARD-ABI: BL &fma, {{.*}}, implicit $d0, implicit $d1, implicit $d2, implicit-def $d0
; HARD-ABI: [[R:%[0-9]+]]:_(s64) = COPY $d0
; SOFT: ADJCALLSTACKUP
; SOFT-NOT: G_FMA
%6(s64) = G_FMA %4, %4, %5
; HARD: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
; HARD-ABI: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
%7(s32),%8(s32) = G_UNMERGE_VALUES %6(s64)
; CHECK-DAG: $r0 = COPY [[R0]]
; CHECK-DAG: $r1 = COPY [[R1]]
$r0 = COPY %7(s32)
$r1 = COPY %8(s32)
BX_RET 14, $noreg, implicit $r0, implicit $r1
...