summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Reassociate
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2014-11-14 17:08:15 +0000
committerChad Rosier <mcrosier@codeaurora.org>2014-11-14 17:08:15 +0000
commitd99df68e19be0c941fb4eff0a18c482a8e4a22f7 (patch)
tree55ff7eef94db7d1d168a10bed076c61d7bb7a6fa /llvm/test/Transforms/Reassociate
parentf8b55f1bc5aa5278716a77bcd02915e0d1e757ab (diff)
downloadbcm5719-llvm-d99df68e19be0c941fb4eff0a18c482a8e4a22f7.tar.gz
bcm5719-llvm-d99df68e19be0c941fb4eff0a18c482a8e4a22f7.zip
[Reassociate] Canonicalize operands of vector binary operators.
Prior to this commit fmul and fadd binary operators were being canonicalized for both scalar and vector versions. We now canonicalize add, mul, and, or, and xor vector instructions. llvm-svn: 222006
Diffstat (limited to 'llvm/test/Transforms/Reassociate')
-rw-r--r--llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll52
1 files changed, 50 insertions, 2 deletions
diff --git a/llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll b/llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll
index ab38edae0c4..eeae096bf94 100644
--- a/llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll
+++ b/llvm/test/Transforms/Reassociate/fast-ReassociateVector.ll
@@ -11,11 +11,11 @@ define <4 x float> @test1() {
ret <4 x float> %tmp2
}
-; We don't currently commute integer vector operations.
+; Commute integer vector operations.
define <2 x i32> @test2(<2 x i32> %x, <2 x i32> %y) {
; CHECK-LABEL: test2
; CHECK-NEXT: %tmp1 = add <2 x i32> %x, %y
-; CHECK-NEXT: %tmp2 = add <2 x i32> %y, %x
+; CHECK-NEXT: %tmp2 = add <2 x i32> %x, %y
; CHECK-NEXT: %tmp3 = add <2 x i32> %tmp1, %tmp2
%tmp1 = add <2 x i32> %x, %y
@@ -23,3 +23,51 @@ define <2 x i32> @test2(<2 x i32> %x, <2 x i32> %y) {
%tmp3 = add <2 x i32> %tmp1, %tmp2
ret <2 x i32> %tmp3
}
+
+define <2 x i32> @test3(<2 x i32> %x, <2 x i32> %y) {
+; CHECK-LABEL: test3
+; CHECK-NEXT: %tmp1 = mul <2 x i32> %x, %y
+; CHECK-NEXT: %tmp2 = mul <2 x i32> %x, %y
+; CHECK-NEXT: %tmp3 = mul <2 x i32> %tmp1, %tmp2
+
+ %tmp1 = mul <2 x i32> %x, %y
+ %tmp2 = mul <2 x i32> %y, %x
+ %tmp3 = mul <2 x i32> %tmp1, %tmp2
+ ret <2 x i32> %tmp3
+}
+
+define <2 x i32> @test4(<2 x i32> %x, <2 x i32> %y) {
+; CHECK-LABEL: test4
+; CHECK-NEXT: %tmp1 = and <2 x i32> %x, %y
+; CHECK-NEXT: %tmp2 = and <2 x i32> %x, %y
+; CHECK-NEXT: %tmp3 = and <2 x i32> %tmp1, %tmp2
+
+ %tmp1 = and <2 x i32> %x, %y
+ %tmp2 = and <2 x i32> %y, %x
+ %tmp3 = and <2 x i32> %tmp1, %tmp2
+ ret <2 x i32> %tmp3
+}
+
+define <2 x i32> @test5(<2 x i32> %x, <2 x i32> %y) {
+; CHECK-LABEL: test5
+; CHECK-NEXT: %tmp1 = or <2 x i32> %x, %y
+; CHECK-NEXT: %tmp2 = or <2 x i32> %x, %y
+; CHECK-NEXT: %tmp3 = or <2 x i32> %tmp1, %tmp2
+
+ %tmp1 = or <2 x i32> %x, %y
+ %tmp2 = or <2 x i32> %y, %x
+ %tmp3 = or <2 x i32> %tmp1, %tmp2
+ ret <2 x i32> %tmp3
+}
+
+define <2 x i32> @test6(<2 x i32> %x, <2 x i32> %y) {
+; CHECK-LABEL: test6
+; CHECK-NEXT: %tmp1 = xor <2 x i32> %x, %y
+; CHECK-NEXT: %tmp2 = xor <2 x i32> %x, %y
+; CHECK-NEXT: %tmp3 = xor <2 x i32> %tmp1, %tmp2
+
+ %tmp1 = xor <2 x i32> %x, %y
+ %tmp2 = xor <2 x i32> %y, %x
+ %tmp3 = xor <2 x i32> %tmp1, %tmp2
+ ret <2 x i32> %tmp3
+}
OpenPOWER on IntegriCloud