44; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+fullfp16 | FileCheck %s --check-prefix=LE-FP16
55; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+fullfp16 | FileCheck %s --check-prefix=BE-FP16
66
7+ ;; Global ISel successfully generates code for some functions for little-endian
8+ ;; without +fullfp16, and falls back to SelectionDAG in all others.
9+ ; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=LE-GISEL
10+ ; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=BE
11+ ; RUN: llc -mtriple=armv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+fullfp16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=LE-FP16
12+ ; RUN: llc -mtriple=armebv8m.main-none-eabi < %s -frame-pointer=none -mattr=+fp-armv8d16,+fullfp16 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefix=BE-FP16
13+
714define arm_aapcscc half @callee_soft_half_in_reg (half %f ) {
815; LE-LABEL: callee_soft_half_in_reg:
916; LE: @ %bb.0: @ %entry
@@ -24,6 +31,10 @@ define arm_aapcscc half @callee_soft_half_in_reg(half %f) {
2431; BE-FP16-NEXT: vmov.f16 s0, r0
2532; BE-FP16-NEXT: vmov r0, s0
2633; BE-FP16-NEXT: bx lr
34+ ;
35+ ; LE-GISEL-LABEL: callee_soft_half_in_reg:
36+ ; LE-GISEL: @ %bb.0: @ %entry
37+ ; LE-GISEL-NEXT: bx lr
2738entry:
2839 ret half %f
2940}
@@ -60,6 +71,14 @@ define void @caller_soft_half_in_reg() {
6071; BE-FP16-NEXT: mov.w r0, #15360
6172; BE-FP16-NEXT: bl callee_soft_half_in_reg
6273; BE-FP16-NEXT: pop {r7, pc}
74+ ;
75+ ; LE-GISEL-LABEL: caller_soft_half_in_reg:
76+ ; LE-GISEL: @ %bb.0: @ %entry
77+ ; LE-GISEL-NEXT: .save {r7, lr}
78+ ; LE-GISEL-NEXT: push {r7, lr}
79+ ; LE-GISEL-NEXT: mov.w r0, #15360
80+ ; LE-GISEL-NEXT: bl callee_soft_half_in_reg
81+ ; LE-GISEL-NEXT: pop {r7, pc}
6382entry:
6483 %ret = call arm_aapcscc half @callee_soft_half_in_reg (half 1 .0 )
6584 ret void
@@ -87,6 +106,12 @@ define arm_aapcscc half @callee_soft_half_on_stack(float %r0, float %r1, float %
87106; BE-FP16-NEXT: vldr.16 s0, [sp, #2]
88107; BE-FP16-NEXT: vmov r0, s0
89108; BE-FP16-NEXT: bx lr
109+ ;
110+ ; LE-GISEL-LABEL: callee_soft_half_on_stack:
111+ ; LE-GISEL: @ %bb.0: @ %entry
112+ ; LE-GISEL-NEXT: mov r0, sp
113+ ; LE-GISEL-NEXT: ldr r0, [r0]
114+ ; LE-GISEL-NEXT: bx lr
90115entry:
91116 ret half %f
92117}
@@ -139,6 +164,18 @@ define void @caller_soft_half_on_stack() {
139164; BE-FP16-NEXT: bl callee_soft_half_on_stack
140165; BE-FP16-NEXT: add sp, #8
141166; BE-FP16-NEXT: pop {r7, pc}
167+ ;
168+ ; LE-GISEL-LABEL: caller_soft_half_on_stack:
169+ ; LE-GISEL: @ %bb.0: @ %entry
170+ ; LE-GISEL-NEXT: .save {r7, lr}
171+ ; LE-GISEL-NEXT: push {r7, lr}
172+ ; LE-GISEL-NEXT: .pad #8
173+ ; LE-GISEL-NEXT: sub sp, #8
174+ ; LE-GISEL-NEXT: mov.w r0, #15360
175+ ; LE-GISEL-NEXT: str r0, [sp]
176+ ; LE-GISEL-NEXT: bl callee_soft_half_on_stack
177+ ; LE-GISEL-NEXT: add sp, #8
178+ ; LE-GISEL-NEXT: pop {r7, pc}
142179entry:
143180 %ret = call arm_aapcscc half @callee_soft_half_on_stack (float poison, float poison, float poison, float poison, half 1 .0 )
144181 ret void
@@ -160,6 +197,10 @@ define arm_aapcs_vfpcc half @callee_hard_half_in_reg(half %f) {
160197; BE-FP16-LABEL: callee_hard_half_in_reg:
161198; BE-FP16: @ %bb.0: @ %entry
162199; BE-FP16-NEXT: bx lr
200+ ;
201+ ; LE-GISEL-LABEL: callee_hard_half_in_reg:
202+ ; LE-GISEL: @ %bb.0: @ %entry
203+ ; LE-GISEL-NEXT: bx lr
163204entry:
164205 ret half %f
165206}
@@ -204,6 +245,18 @@ define void @caller_hard_half_in_reg() {
204245; BE-FP16-NEXT: vmov.f16 s0, #1.000000e+00
205246; BE-FP16-NEXT: bl callee_hard_half_in_reg
206247; BE-FP16-NEXT: pop {r7, pc}
248+ ;
249+ ; LE-GISEL-LABEL: caller_hard_half_in_reg:
250+ ; LE-GISEL: @ %bb.0: @ %entry
251+ ; LE-GISEL-NEXT: .save {r7, lr}
252+ ; LE-GISEL-NEXT: push {r7, lr}
253+ ; LE-GISEL-NEXT: vldr s0, .LCPI5_0
254+ ; LE-GISEL-NEXT: bl callee_hard_half_in_reg
255+ ; LE-GISEL-NEXT: pop {r7, pc}
256+ ; LE-GISEL-NEXT: .p2align 2
257+ ; LE-GISEL-NEXT: @ %bb.1:
258+ ; LE-GISEL-NEXT: .LCPI5_0:
259+ ; LE-GISEL-NEXT: .long 0x00003c00 @ float 2.15239444E-41
207260entry:
208261 %ret = call arm_aapcs_vfpcc half @callee_hard_half_in_reg (half 1 .0 )
209262 ret void
@@ -229,6 +282,13 @@ define arm_aapcs_vfpcc half @callee_hard_half_on_stack(float %s0, float %s1, flo
229282; BE-FP16: @ %bb.0: @ %entry
230283; BE-FP16-NEXT: vldr.16 s0, [sp, #2]
231284; BE-FP16-NEXT: bx lr
285+ ;
286+ ; LE-GISEL-LABEL: callee_hard_half_on_stack:
287+ ; LE-GISEL: @ %bb.0: @ %entry
288+ ; LE-GISEL-NEXT: mov r0, sp
289+ ; LE-GISEL-NEXT: ldr r0, [r0]
290+ ; LE-GISEL-NEXT: vmov s0, r0
291+ ; LE-GISEL-NEXT: bx lr
232292entry:
233293 ret half %f
234294}
@@ -282,6 +342,18 @@ define void @caller_hard_half_on_stack() {
282342; BE-FP16-NEXT: bl callee_hard_half_on_stack
283343; BE-FP16-NEXT: add sp, #8
284344; BE-FP16-NEXT: pop {r7, pc}
345+ ;
346+ ; LE-GISEL-LABEL: caller_hard_half_on_stack:
347+ ; LE-GISEL: @ %bb.0: @ %entry
348+ ; LE-GISEL-NEXT: .save {r7, lr}
349+ ; LE-GISEL-NEXT: push {r7, lr}
350+ ; LE-GISEL-NEXT: .pad #8
351+ ; LE-GISEL-NEXT: sub sp, #8
352+ ; LE-GISEL-NEXT: mov.w r0, #15360
353+ ; LE-GISEL-NEXT: str r0, [sp]
354+ ; LE-GISEL-NEXT: bl callee_hard_half_on_stack
355+ ; LE-GISEL-NEXT: add sp, #8
356+ ; LE-GISEL-NEXT: pop {r7, pc}
285357entry:
286358 %ret = call arm_aapcs_vfpcc half @callee_hard_half_on_stack (float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison, half 1 .0 )
287359 ret void
0 commit comments