blob: dce62af76694eca99f77275438b30ba84099b8e6 [file] [log] [blame]
Andrew Lenharth731f2d52006-09-19 18:23:39 +00001; Tests to make sure elimination of casts is working correctly
Reid Spencerd0e30dc2006-12-02 04:23:10 +00002; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
Andrew Lenharthf7a53322007-02-22 15:17:45 +00003; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep '\([sz]ext\)\|\(trunc\)|\(ptrtoint\)'
Andrew Lenharth731f2d52006-09-19 18:23:39 +00004
5target pointersize = 32
6
7implementation
8
9sbyte* %test1(sbyte* %t) {
10 %tmpc = cast sbyte* %t to uint
11 %tmpa = add uint %tmpc, 32
12 %tv = cast uint %tmpa to sbyte*
13 ret sbyte* %tv
14}
15
Andrew Lenharthf7a53322007-02-22 15:17:45 +000016bool %test2(sbyte* %a, sbyte* %b) {
17%tmpa = cast sbyte* %a to uint
18%tmpb = cast sbyte* %b to uint
19%r = seteq uint %tmpa, %tmpb
20ret bool %r
21}