--- /dev/null
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: if as < %s | opt -instcombine -dce | dis | grep and
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+int "test1"(int %A) {
+ %B = and int %A, 0 ; zero result
+ ret int %B
+}
+
+int "test2"(int %A) {
+ %B = and int %A, -1 ; noop
+ ret int %B
+}
+
+bool "test3"(bool %A) {
+ %B = and bool %A, false ; always = false
+ ret bool %B
+}
+
+bool "test4"(bool %A) {
+ %B = and bool %A, true ; noop
+ ret bool %B
+}
+
+
--- /dev/null
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: if as < %s | opt -instcombine -dce | dis | grep or
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+int "test1"(int %A) {
+ %B = or int %A, 0
+ ret int %B
+}
+
+int "test2"(int %A) {
+ %B = or int %A, -1
+ ret int %B
+}
+
+bool "test3"(bool %A) {
+ %B = or bool %A, false
+ ret bool %B
+}
+
+bool "test4"(bool %A) {
+ %B = or bool %A, true
+ ret bool %B
+}
+
+bool "test5"(bool %A) {
+ %B = xor bool %A, false
+ ret bool %B
+}
+
+int "test5"(int %A) {
+ %B = xor int %A, 0
+ ret int %B
+}
+
+
--- /dev/null
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: if as < %s | opt -instcombine -dce | dis | grep rem
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+int "test1"(int %A) {
+ %B = rem int %A, 1 ; ISA constant 0
+ ret int %B
+}
+
--- /dev/null
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: if as < %s | opt -instcombine -dce | dis | grep sh
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+int "test1"(int %A) {
+ %B = shl int %A, ubyte 0
+ ret int %B
+}
+
+int "test2"(ubyte %A) {
+ %B = shl int 0, ubyte %A
+ ret int %B
+}
+
+int "test3"(int %A) {
+ %B = shr int %A, ubyte 0
+ ret int %B
+}
+
+int "test4"(ubyte %A) {
+ %B = shr int 0, ubyte %A
+ ret int %B
+}
+
+int "test5"(int %A) {
+ %B = shr int %A, ubyte 32 ;; shift all bits out
+ ret int %B
+}
+