blob: dd4b42aee07eee52705737f1c01fa9c78b443ad2 [file] [log] [blame]
Chris Lattner74e95472002-05-06 05:43:36 +00001; This test makes sure that these instructions are properly eliminated.
2;
3
Misha Brukmanedf4bab2003-09-16 15:29:54 +00004; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
Chris Lattner74e95472002-05-06 05:43:36 +00005
6implementation
7
Chris Lattnerc5fccf32003-02-18 19:28:47 +00008int %test1(int %A) {
Chris Lattner74e95472002-05-06 05:43:36 +00009 %B = rem int %A, 1 ; ISA constant 0
10 ret int %B
11}
12
Chris Lattnerc5fccf32003-02-18 19:28:47 +000013int %test2(int %A) { ; 0 % X = 0, we don't need ot preserve traps
14 %B = rem int 0, %A
15 ret int %B
16}
17
18uint %test3(uint %A) {
19 %B = rem uint %A, 8 ; & 7
20 ret uint %B
21}
Chris Lattnereca92d32004-07-06 07:38:00 +000022
23bool %test3(int %A) {
24 %B = rem int %A, -8 ; & 7
25 %C = setne int %B, 0
26 ret bool %C
27}