blob: 5f0e1170f0448febf878b5260a9bff48c61260a4 [file] [log] [blame]
Bill Wendlingcd6df162012-04-24 09:15:38 +00001; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s
Chandler Carruthbebc3bb2007-08-06 20:57:16 +00002; PR1600
Chandler Carruthbebc3bb2007-08-06 20:57:16 +00003
Chandler Carruth6b0e34c2011-12-12 11:59:10 +00004declare i16 @llvm.cttz.i16(i16, i1)
Chandler Carruthbebc3bb2007-08-06 20:57:16 +00005
6define i32 @test(i32* %P, i16* %Q) {
Bill Wendlingcd6df162012-04-24 09:15:38 +00007; CHECK: ret i32 0
David Blaikiea79ac142015-02-27 21:17:42 +00008 %A = load i16, i16* %Q ; <i16> [#uses=1]
9 %x = load i32, i32* %P ; <i32> [#uses=1]
Chandler Carruth6b0e34c2011-12-12 11:59:10 +000010 %B = call i16 @llvm.cttz.i16( i16 %A, i1 true ) ; <i16> [#uses=1]
David Blaikiea79ac142015-02-27 21:17:42 +000011 %y = load i32, i32* %P ; <i32> [#uses=1]
Chandler Carruthbebc3bb2007-08-06 20:57:16 +000012 store i16 %B, i16* %Q
13 %z = sub i32 %x, %y ; <i32> [#uses=1]
14 ret i32 %z
15}
16