xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/fast-isel-fpconv.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple powerpc64-unknown-linux-gnu -fast-isel -O0 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; The second fctiwz would use an incorrect input register due to wrong handling
4*9880d681SAndroid Build Coastguard Worker; of COPY_TO_REGCLASS in the FastISel pass.  Verify that this is fixed.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare void @func(i32, i32)
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @test() {
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test:
10*9880d681SAndroid Build Coastguard Worker; CHECK: bl func
11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: nop
12*9880d681SAndroid Build Coastguard Worker; CHECK: lfs [[REG:[0-9]+]],
13*9880d681SAndroid Build Coastguard Worker; CHECK: fctiwz {{[0-9]+}}, [[REG]]
14*9880d681SAndroid Build Coastguard Worker; CHECK: bl func
15*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: nop
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker  %memPos = alloca float, align 4
18*9880d681SAndroid Build Coastguard Worker  store float 1.500000e+01, float* %memPos
19*9880d681SAndroid Build Coastguard Worker  %valPos = load float, float* %memPos
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker  %memNeg = alloca float, align 4
22*9880d681SAndroid Build Coastguard Worker  store float -1.500000e+01, float* %memNeg
23*9880d681SAndroid Build Coastguard Worker  %valNeg = load float, float* %memNeg
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker  %FloatToIntPos = fptosi float %valPos to i32
26*9880d681SAndroid Build Coastguard Worker  call void @func(i32 15, i32 %FloatToIntPos)
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker  %FloatToIntNeg = fptosi float %valNeg to i32
29*9880d681SAndroid Build Coastguard Worker  call void @func(i32 -15, i32 %FloatToIntNeg)
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34