1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00

New testcases so I don't forget about these algebraic simplifications

llvm-svn: 2479
This commit is contained in:
Chris Lattner 2002-05-06 05:43:36 +00:00
parent 36af244bcb
commit c019944886
4 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,31 @@
; 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
}

View File

@ -0,0 +1,41 @@
; 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
}

View File

@ -0,0 +1,15 @@
; 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
}

View File

@ -0,0 +1,35 @@
; 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
}