1 # RUN: llc -mtriple arm-linux-gnueabihf -mattr=+vfp4 -float-abi=hard -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix HARD
2 # 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
3 # 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
4 # 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
6 define void @test_fma_float() { ret void }
7 define void @test_fma_double() { ret void }
11 # CHECK-LABEL: name: test_fma_float
13 # CHECK: legalized: true
14 regBankSelected: false
16 tracksRegLiveness: true
24 liveins: $r0, $r1, $r2
26 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0
27 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1
28 ; CHECK-DAG: [[Z:%[0-9]+]]:_(s32) = COPY $r2
32 ; HARD: [[R:%[0-9]+]]:_(s32) = G_FMA [[X]], [[Y]], [[Z]]
34 ; SOFT: ADJCALLSTACKDOWN
35 ; SOFT-ABI-DAG: $r0 = COPY [[X]]
36 ; SOFT-ABI-DAG: $r1 = COPY [[Y]]
37 ; SOFT-ABI-DAG: $r2 = COPY [[Z]]
38 ; SOFT-ABI: BL &fmaf, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit-def $r0
39 ; SOFT-ABI: [[R:%[0-9]+]]:_(s32) = COPY $r0
40 ; HARD-ABI-DAG: $s0 = COPY [[X]]
41 ; HARD-ABI-DAG: $s1 = COPY [[Y]]
42 ; HARD-ABI-DAG: $s2 = COPY [[Z]]
43 ; HARD-ABI: BL &fmaf, {{.*}}, implicit $s0, implicit $s1, implicit $s2, implicit-def $s0
44 ; HARD-ABI: [[R:%[0-9]+]]:_(s32) = COPY $s0
45 ; SOFT: ADJCALLSTACKUP
47 %3(s32) = G_FMA %0, %1, %2
48 ; CHECK: $r0 = COPY [[R]]
50 BX_RET 14, $noreg, implicit $r0
54 # CHECK-LABEL: name: test_fma_double
56 # CHECK: legalized: true
57 regBankSelected: false
59 tracksRegLiveness: true
72 liveins: $r0, $r1, $r2, $r3
74 ; CHECK-DAG: [[X0:%[0-9]+]]:_(s32) = COPY $r0
75 ; CHECK-DAG: [[X1:%[0-9]+]]:_(s32) = COPY $r1
76 ; CHECK-DAG: [[Y0:%[0-9]+]]:_(s32) = COPY $r2
77 ; CHECK-DAG: [[Y1:%[0-9]+]]:_(s32) = COPY $r3
82 ; HARD-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
83 ; HARD-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
84 ; HARD-ABI-DAG: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]]
85 ; HARD-ABI-DAG: [[Y:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[Y0]]
86 %4(s64) = G_MERGE_VALUES %0(s32), %1(s32)
87 %5(s64) = G_MERGE_VALUES %2(s32), %3(s32)
88 ; HARD: [[R:%[0-9]+]]:_(s64) = G_FMA [[X]], [[X]], [[Y]]
90 ; SOFT: ADJCALLSTACKDOWN
91 ; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X0]]
92 ; SOFT-ABI-DAG: $r{{[0-1]}} = COPY [[X1]]
93 ; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X0]]
94 ; SOFT-ABI-DAG: $r{{[2-3]}} = COPY [[X1]]
95 ; SOFT-ABI: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
96 ; SOFT-ABI: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
97 ; SOFT-ABI: [[FI1:%[0-9]+]]:_(p0) = G_GEP [[SP1]], [[OFF1]](s32)
99 ; FIXME: This ought to be align 8 but ARM's call lowering hardcodes it to 1
100 ; SOFT-ABI: G_STORE [[Y0]](s32), [[FI1]](p0){{.*}}store 4 into stack, align 1)
101 ; SOFT-ABI: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
102 ; SOFT-ABI: [[FI2:%[0-9]+]]:_(p0) = G_GEP [[FI1]], [[OFF2]](s32)
103 ; SOFT-ABI: G_STORE [[Y1]](s32), [[FI2]](p0){{.*}}store 4 into stack + 4, align 1)
104 ; SOFT-ABI: BL &fma, {{.*}}, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
105 ; SOFT-ABI-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0
106 ; SOFT-ABI-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1
107 ; HARD-ABI-DAG: $d0 = COPY [[X]]
108 ; HARD-ABI-DAG: $d1 = COPY [[X]]
109 ; HARD-ABI-DAG: $d2 = COPY [[Y]]
110 ; HARD-ABI: BL &fma, {{.*}}, implicit $d0, implicit $d1, implicit $d2, implicit-def $d0
111 ; HARD-ABI: [[R:%[0-9]+]]:_(s64) = COPY $d0
112 ; SOFT: ADJCALLSTACKUP
114 %6(s64) = G_FMA %4, %4, %5
115 ; HARD: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
116 ; HARD-ABI: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[R]](s64)
117 %7(s32),%8(s32) = G_UNMERGE_VALUES %6(s64)
118 ; CHECK-DAG: $r0 = COPY [[R0]]
119 ; CHECK-DAG: $r1 = COPY [[R1]]
122 BX_RET 14, $noreg, implicit $r0, implicit $r1