[ARM] GlobalISel: Test hard float properly

It turns out -float-abi=hard doesn't set the hard float calling
convention for libcalls. We need to use a hard float triple instead
(e.g. gnueabihf).

llvm-svn: 299761
This commit is contained in:
Diana Picus 2017-04-07 12:04:24 +00:00
parent a77d32b7af
commit fed80723c0
1 changed files with 26 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# RUN: llc -mtriple arm-- -mattr=+vfp2 -float-abi=hard -global-isel -run-pass=legalizer %s -o - | FileCheck %s # RUN: llc -mtriple arm-gnueabihf -mattr=+vfp2 -float-abi=hard -global-isel -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix HARD
# RUN: llc -mtriple arm-- -mattr=+vfp2 -float-abi=soft -global-isel -run-pass=legalizer %s -o - | FileCheck %s # RUN: llc -mtriple arm-- -mattr=+vfp2 -float-abi=soft -global-isel -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT
# RUN: llc -mtriple arm-- -float-abi=soft -global-isel -run-pass=legalizer %s -o - | FileCheck %s # RUN: llc -mtriple arm-- -float-abi=soft -global-isel -run-pass=legalizer %s -o - | FileCheck %s -check-prefix CHECK -check-prefix SOFT
--- | --- |
define void @test_frem_float() { ret void } define void @test_frem_float() { ret void }
define void @test_frem_double() { ret void } define void @test_frem_double() { ret void }
@ -26,10 +26,14 @@ body: |
%0(s32) = COPY %r0 %0(s32) = COPY %r0
%1(s32) = COPY %r1 %1(s32) = COPY %r1
; CHECK: ADJCALLSTACKDOWN ; CHECK: ADJCALLSTACKDOWN
; CHECK-DAG: %r0 = COPY [[X]] ; SOFT-DAG: %r0 = COPY [[X]]
; CHECK-DAG: %r1 = COPY [[Y]] ; SOFT-DAG: %r1 = COPY [[Y]]
; CHECK: BLX $fmodf, {{.*}}, implicit %r0, implicit %r1, implicit-def %r0 ; HARD-DAG: %s0 = COPY [[X]]
; CHECK: [[R:%[0-9]+]](s32) = COPY %r0 ; HARD-DAG: %s1 = COPY [[Y]]
; SOFT: BLX $fmodf, {{.*}}, implicit %r0, implicit %r1, implicit-def %r0
; HARD: BLX $fmodf, {{.*}}, implicit %s0, implicit %s1, implicit-def %s0
; SOFT: [[R:%[0-9]+]](s32) = COPY %r0
; HARD: [[R:%[0-9]+]](s32) = COPY %s0
; CHECK: ADJCALLSTACKUP ; CHECK: ADJCALLSTACKUP
%2(s32) = G_FREM %0, %1 %2(s32) = G_FREM %0, %1
; CHECK: %r0 = COPY [[R]] ; CHECK: %r0 = COPY [[R]]
@ -59,10 +63,11 @@ body: |
liveins: %r0, %r1, %r2, %r3 liveins: %r0, %r1, %r2, %r3
; The inputs may be in the wrong order (depending on the target's ; The inputs may be in the wrong order (depending on the target's
; endianness), but that's orthogonal to what we're trying to test here. We ; endianness), but that's orthogonal to what we're trying to test here.
; only need to check that the first value, received through R0-R1, ends up ; For soft float, we only need to check that the first value, received
; in R0-R1 or R1-R0, and the second value, received through R2-R3, ends up ; through R0-R1, ends up in R0-R1 or R1-R0, and the second value, received
; in R2-R3 or R3-R2, when passed to fmod. ; through R2-R3, ends up in R2-R3 or R3-R2, when passed to fmod.
; For hard float, the values need to end up in D0 and D1.
; CHECK-DAG: [[X0:%[0-9]+]](s32) = COPY %r0 ; CHECK-DAG: [[X0:%[0-9]+]](s32) = COPY %r0
; CHECK-DAG: [[X1:%[0-9]+]](s32) = COPY %r1 ; CHECK-DAG: [[X1:%[0-9]+]](s32) = COPY %r1
; CHECK-DAG: [[Y0:%[0-9]+]](s32) = COPY %r2 ; CHECK-DAG: [[Y0:%[0-9]+]](s32) = COPY %r2
@ -71,14 +76,19 @@ body: |
%1(s32) = COPY %r1 %1(s32) = COPY %r1
%2(s32) = COPY %r2 %2(s32) = COPY %r2
%3(s32) = COPY %r3 %3(s32) = COPY %r3
; HARD-DAG: [[X:%[0-9]+]](s64) = G_SEQUENCE [[X0]]
; HARD-DAG: [[Y:%[0-9]+]](s64) = G_SEQUENCE [[Y0]]
%4(s64) = G_SEQUENCE %0(s32), 0, %1(s32), 32 %4(s64) = G_SEQUENCE %0(s32), 0, %1(s32), 32
%5(s64) = G_SEQUENCE %2(s32), 0, %3(s32), 32 %5(s64) = G_SEQUENCE %2(s32), 0, %3(s32), 32
; CHECK: ADJCALLSTACKDOWN ; CHECK: ADJCALLSTACKDOWN
; CHECK-DAG: %r{{[0-1]}} = COPY [[X0]] ; SOFT-DAG: %r{{[0-1]}} = COPY [[X0]]
; CHECK-DAG: %r{{[0-1]}} = COPY [[X1]] ; SOFT-DAG: %r{{[0-1]}} = COPY [[X1]]
; CHECK-DAG: %r{{[2-3]}} = COPY [[Y0]] ; SOFT-DAG: %r{{[2-3]}} = COPY [[Y0]]
; CHECK-DAG: %r{{[2-3]}} = COPY [[Y1]] ; SOFT-DAG: %r{{[2-3]}} = COPY [[Y1]]
; CHECK: BLX $fmod, {{.*}}, implicit %r0, implicit %r1, implicit %r2, implicit %r3, implicit-def %r0, implicit-def %r1 ; HARD-DAG: %d0 = COPY [[X]]
; HARD-DAG: %d1 = COPY [[Y]]
; SOFT: BLX $fmod, {{.*}}, implicit %r0, implicit %r1, implicit %r2, implicit %r3, implicit-def %r0, implicit-def %r1
; HARD: BLX $fmod, {{.*}}, implicit %d0, implicit %d1, implicit-def %d0
; CHECK: ADJCALLSTACKUP ; CHECK: ADJCALLSTACKUP
%6(s64) = G_FREM %4, %5 %6(s64) = G_FREM %4, %5
%7(s32) = G_EXTRACT %6(s64), 0 %7(s32) = G_EXTRACT %6(s64), 0