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