• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -S -early-cse | FileCheck %s
2
3; CHECK-LABEL: @test1(
4define void @test1(float %A, float %B, float* %PA, float* %PB) {
5  ; CHECK-NEXT: fadd
6  ; CHECK-NEXT: store
7  ; CHECK-NEXT: store
8  ; CHECK-NEXT: ret
9  %C = fadd float %A, %B
10  store float %C, float* %PA
11  %D = fadd float %B, %A
12  store float %D, float* %PB
13  ret void
14}
15
16; CHECK-LABEL: @test2(
17define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
18  ; CHECK-NEXT: fcmp
19  ; CHECK-NEXT: store
20  ; CHECK-NEXT: store
21  ; CHECK-NEXT: ret
22  %C = fcmp oeq float %A, %B
23  store i1 %C, i1* %PA
24  %D = fcmp oeq float %B, %A
25  store i1 %D, i1* %PB
26  ret void
27}
28
29; CHECK-LABEL: @test3(
30define void @test3(float %A, float %B, i1* %PA, i1* %PB) {
31  ; CHECK-NEXT: fcmp
32  ; CHECK-NEXT: store
33  ; CHECK-NEXT: store
34  ; CHECK-NEXT: ret
35  %C = fcmp uge float %A, %B
36  store i1 %C, i1* %PA
37  %D = fcmp ule float %B, %A
38  store i1 %D, i1* %PB
39  ret void
40}
41
42; CHECK-LABEL: @test4(
43define void @test4(i32 %A, i32 %B, i1* %PA, i1* %PB) {
44  ; CHECK-NEXT: icmp
45  ; CHECK-NEXT: store
46  ; CHECK-NEXT: store
47  ; CHECK-NEXT: ret
48  %C = icmp eq i32 %A, %B
49  store i1 %C, i1* %PA
50  %D = icmp eq i32 %B, %A
51  store i1 %D, i1* %PB
52  ret void
53}
54
55; CHECK-LABEL: @test5(
56define void @test5(i32 %A, i32 %B, i1* %PA, i1* %PB) {
57  ; CHECK-NEXT: icmp
58  ; CHECK-NEXT: store
59  ; CHECK-NEXT: store
60  ; CHECK-NEXT: ret
61  %C = icmp sgt i32 %A, %B
62  store i1 %C, i1* %PA
63  %D = icmp slt i32 %B, %A
64  store i1 %D, i1* %PB
65  ret void
66}
67