blob: 74280ee7f7cad1a132b92c9a2a301ce6d7d0f054 [file] [log] [blame]
Reid Spencerea8b07e2007-03-23 20:48:34 +00001; This test makes sure that add instructions are properly eliminated.
2; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
3
Reid Spencerea8b07e2007-03-23 20:48:34 +00004; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
5; RUN: grep -v OK | not grep add
6
Reid Spencerea8b07e2007-03-23 20:48:34 +00007
8define i1 @test1(i1 %x) {
9 %tmp.2 = xor i1 %x, 1
10 ;; Add of sign bit -> xor of sign bit.
11 %tmp.4 = add i1 %tmp.2, 1
12 ret i1 %tmp.4
13}
14
15define i47 @test2(i47 %x) {
16 %tmp.2 = xor i47 %x, 70368744177664
17 ;; Add of sign bit -> xor of sign bit.
18 %tmp.4 = add i47 %tmp.2, 70368744177664
19 ret i47 %tmp.4
20}
21
22define i15 @test3(i15 %x) {
23 %tmp.2 = xor i15 %x, 16384
24 ;; Add of sign bit -> xor of sign bit.
25 %tmp.4 = add i15 %tmp.2, 16384
26 ret i15 %tmp.4
27}
28
Reid Spencerea8b07e2007-03-23 20:48:34 +000029define i49 @test6(i49 %x) {
30 ;; (x & 254)+1 -> (x & 254)|1
31 %tmp.2 = and i49 %x, 562949953421310
32 %tmp.4 = add i49 %tmp.2, 1
33 ret i49 %tmp.4
34}