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