Remove usage of grep-not script
[oota-llvm.git] / test / Transforms / InstCombine / sub.ll
index 8b164cb51e5ac486915911cbf6c226a949d0c71f..2003abdbc1bd290eb06f38cdbc7deb58524522ca 100644 (file)
@@ -1,10 +1,7 @@
 ; This test makes sure that these instructions are properly eliminated.
 ;
 
-; RUN: if as < %s | opt -instcombine -die | dis | grep sub | grep -v 'sub int %Cok, %Bok'
-; RUN: then exit 1
-; RUN: else exit 0
-; RUN: fi
+; RUN: as < %s | opt -instcombine -die | dis | grep sub | not grep -v 'sub int %Cok, %Bok'
 
 implementation
 
@@ -47,3 +44,28 @@ int %test7(int %A) {
        ret int %B
 }
 
+int %test8(int %A) {
+        %B = mul int 9, %A
+        %C = sub int %B, %A      ; C = 9*A-A == A*8 == A << 3
+        ret int %C
+}
+
+int %test9(int %A) {
+        %B = mul int 3, %A
+        %C = sub int %A, %B      ; C = A-3*A == A*-2
+        ret int %C
+}
+
+int %test10(int %A, int %B) {    ; -A*-B == A*B
+       %C = sub int 0, %A
+       %D = sub int 0, %B
+       %E = mul int %C, %D
+       ret int %E
+}
+
+int %test10(int %A) {    ; -A *c1 == A * -c1
+       %C = sub int 0, %A
+       %E = mul int %C, 7
+       ret int %E
+}
+