[GlobalISel][AArch64] Add G_FCEIL to isPreISelGenericFloatingPointOpcode

If you don't do this, then if you hit a G_LOAD in getInstrMapping, you'll end
up with GPRs on the G_FCEIL instead of FPRs. This causes a fallback.

Add it to the switch, and add a test verifying that this happens.

llvm-svn: 349822
This commit is contained in:
Jessica Paquette 2018-12-20 21:14:15 +00:00
parent 3447077a28
commit a6b9c68a85
2 changed files with 17 additions and 0 deletions

View File

@ -389,6 +389,7 @@ static bool isPreISelGenericFloatingPointOpcode(unsigned Opc) {
case TargetOpcode::G_FCONSTANT:
case TargetOpcode::G_FPEXT:
case TargetOpcode::G_FPTRUNC:
case TargetOpcode::G_FCEIL:
return true;
}
return false;

View File

@ -0,0 +1,16 @@
; RUN: llc -O=0 -verify-machineinstrs -mtriple aarch64--- \
; RUN: -stop-before=instruction-select -global-isel %s -o - | FileCheck %s
; Make sure that we choose a FPR for the G_FCEIL and G_LOAD instead of a GPR.
declare float @llvm.ceil.f32(float)
; CHECK-LABEL: name: foo
define float @foo(float) {
store float %0, float* undef, align 4
; CHECK: %2:fpr(s32) = G_LOAD %1(p0)
; CHECK-NEXT: %3:fpr(s32) = G_FCEIL %2
%2 = load float, float* undef, align 4
%3 = call float @llvm.ceil.f32(float %2)
ret float %3
}