summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-10-09 16:58:13 +0000
committerMichael Ilseman <milseman@apple.com>2012-10-09 16:58:13 +0000
commitc93cffb590ed8b680d415ec9bc57d89521f6684d (patch)
treeaf6cbef52d9eafea3689d59135e93e23f99e8221
parent336cb79fdfef7ba41788a7eecd73b1f421f2f686 (diff)
downloadbcm5719-llvm-c93cffb590ed8b680d415ec9bc57d89521f6684d.tar.gz
bcm5719-llvm-c93cffb590ed8b680d415ec9bc57d89521f6684d.zip
New EarlyCSE tests for CSE-ing across commutativity.
llvm-svn: 165510
-rw-r--r--llvm/test/Transforms/EarlyCSE/commute.ll66
1 files changed, 66 insertions, 0 deletions
diff --git a/llvm/test/Transforms/EarlyCSE/commute.ll b/llvm/test/Transforms/EarlyCSE/commute.ll
new file mode 100644
index 00000000000..f84a7dd1aae
--- /dev/null
+++ b/llvm/test/Transforms/EarlyCSE/commute.ll
@@ -0,0 +1,66 @@
+; RUN: opt < %s -S -early-cse | FileCheck %s
+
+; CHECK: @test1
+define void @test1(float %A, float %B, float* %PA, float* %PB) {
+ ; CHECK-NEXT: fadd
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: ret
+ %C = fadd float %A, %B
+ store float %C, float* %PA
+ %D = fadd float %B, %A
+ store float %D, float* %PB
+ ret void
+}
+
+; CHECK: @test2
+define void @test2(float %A, float %B, i1* %PA, i1* %PB) {
+ ; CHECK-NEXT: fcmp
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: ret
+ %C = fcmp eq float %A, %B
+ store i1 %C, i1* %PA
+ %D = fcmp eq float %B, %A
+ store i1 %D, i1* %PB
+ ret void
+}
+
+; CHECK: @test3
+define void @test3(float %A, float %B, i1* %PA, i1* %PB) {
+ ; CHECK-NEXT: fcmp
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: ret
+ %C = fcmp uge float %A, %B
+ store i1 %C, i1* %PA
+ %D = fcmp ule float %B, %A
+ store i1 %D, i1* %PB
+ ret void
+}
+
+; CHECK: @test4
+define void @test4(i32 %A, i32 %B, i1* %PA, i1* %PB) {
+ ; CHECK-NEXT: icmp
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: ret
+ %C = icmp eq i32 %A, %B
+ store i1 %C, i1* %PA
+ %D = icmp eq i32 %B, %A
+ store i1 %D, i1* %PB
+ ret void
+}
+
+; CHECK: @test5
+define void @test5(i32 %A, i32 %B, i1* %PA, i1* %PB) {
+ ; CHECK-NEXT: icmp
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: store
+ ; CHECK-NEXT: ret
+ %C = icmp sgt i32 %A, %B
+ store i1 %C, i1* %PA
+ %D = icmp slt i32 %B, %A
+ store i1 %D, i1* %PB
+ ret void
+}
OpenPOWER on IntegriCloud