blob: 88c09e3acdc8ad4990274375e3abdf41f459fd17 [file] [log] [blame]
Craig Topper909652f2011-10-14 03:21:46 +00001; RUN: llc < %s -march=x86-64 -mattr=+bmi | FileCheck %s
2
3define i32 @t1(i32 %x) nounwind {
4 %tmp = tail call i32 @llvm.cttz.i32( i32 %x )
5 ret i32 %tmp
6; CHECK: t1:
7; CHECK: tzcntl
8}
9
10declare i32 @llvm.cttz.i32(i32) nounwind readnone
11
12define i16 @t2(i16 %x) nounwind {
13 %tmp = tail call i16 @llvm.cttz.i16( i16 %x )
14 ret i16 %tmp
15; CHECK: t2:
16; CHECK: tzcntw
17}
18
19declare i16 @llvm.cttz.i16(i16) nounwind readnone
20
21define i64 @t3(i64 %x) nounwind {
22 %tmp = tail call i64 @llvm.cttz.i64( i64 %x )
23 ret i64 %tmp
24; CHECK: t3:
25; CHECK: tzcntq
26}
27
28declare i64 @llvm.cttz.i64(i64) nounwind readnone
29
30define i8 @t4(i8 %x) nounwind {
31 %tmp = tail call i8 @llvm.cttz.i8( i8 %x )
32 ret i8 %tmp
33; CHECK: t4:
34; CHECK: tzcntw
35}
36
37declare i8 @llvm.cttz.i8(i8) nounwind readnone
38
Craig Topper54a11172011-10-14 07:06:56 +000039define i32 @andn32(i32 %x, i32 %y) nounwind readnone {
40 %tmp1 = xor i32 %x, -1
41 %tmp2 = and i32 %y, %tmp1
42 ret i32 %tmp2
43; CHECK: andn32:
44; CHECK: andnl
45}
46
47define i64 @andn64(i64 %x, i64 %y) nounwind readnone {
48 %tmp1 = xor i64 %x, -1
49 %tmp2 = and i64 %tmp1, %y
50 ret i64 %tmp2
51; CHECK: andn64:
52; CHECK: andnq
53}