xref: /llvm-project/llvm/test/CodeGen/PowerPC/stfiwx.ll (revision 5403c59c608c08c8ecd4303763f08eb046eb5e4d)
1; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu -mattr=stfiwx | FileCheck %s
2; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu -mattr=-stfiwx | FileCheck -check-prefix=CHECK-LS %s
3
4define void @test1(float %a, ptr %b) nounwind {
5; CHECK-LABEL: @test1
6; CHECK-LS-LABEL: @test1
7        %tmp.2 = fptosi float %a to i32         ; <i32> [#uses=1]
8        store i32 %tmp.2, ptr %b
9        ret void
10
11; CHECK: stwu
12; CHECK-NOT: lwz
13; CHECK-NOT: stw
14; CHECK: stfiwx
15; CHECK: blr
16
17; CHECK-LS: lwz
18; CHECK-LS: stw
19; CHECK-LS-NOT: stfiwx
20; CHECK-LS: blr
21}
22
23define void @test2(float %a, ptr %b, i32 %i) nounwind {
24; CHECK-LABEL: @test2
25; CHECK-LS-LABEL: @test2
26        %tmp.2 = getelementptr i32, ptr %b, i32 1           ; <ptr> [#uses=1]
27        %tmp.5 = getelementptr i32, ptr %b, i32 %i          ; <ptr> [#uses=1]
28        %tmp.7 = fptosi float %a to i32         ; <i32> [#uses=3]
29        store i32 %tmp.7, ptr %tmp.5
30        store i32 %tmp.7, ptr %tmp.2
31        store i32 %tmp.7, ptr %b
32        ret void
33
34; CHECK: stwu
35; CHECK-NOT: lwz
36; CHECK-NOT: stw
37; CHECK: stfiwx
38; CHECK: blr
39
40; CHECK-LS: lwz
41; CHECK-LS: stw
42; CHECK-LS-NOT: stfiwx
43; CHECK-LS: blr
44}
45