Craig Topper | 909652f | 2011-10-14 03:21:46 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86-64 -mattr=+bmi | FileCheck %s |
| 2 | |
| 3 | define 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 | |
| 10 | declare i32 @llvm.cttz.i32(i32) nounwind readnone |
| 11 | |
| 12 | define 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 | |
| 19 | declare i16 @llvm.cttz.i16(i16) nounwind readnone |
| 20 | |
| 21 | define 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 | |
| 28 | declare i64 @llvm.cttz.i64(i64) nounwind readnone |
| 29 | |
| 30 | define 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 | |
| 37 | declare i8 @llvm.cttz.i8(i8) nounwind readnone |
| 38 | |
Craig Topper | 54a1117 | 2011-10-14 07:06:56 +0000 | [diff] [blame^] | 39 | define 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 | |
| 47 | define 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 | } |