Craig Topper | 19b4a71 | 2011-12-25 15:20:31 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +lzcnt -emit-llvm -o - | FileCheck %s |
Craig Topper | 5c75208 | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 2 | |
| 3 | // Don't include mm_malloc.h, it's system specific. |
| 4 | #define __MM_MALLOC_H |
| 5 | |
| 6 | #include <x86intrin.h> |
| 7 | |
| 8 | unsigned short test__lzcnt16(unsigned short __X) |
| 9 | { |
Craig Topper | 19b4a71 | 2011-12-25 15:20:31 +0000 | [diff] [blame] | 10 | // CHECK: @llvm.ctlz.i16 |
Craig Topper | 5c75208 | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 11 | return __lzcnt16(__X); |
| 12 | } |
| 13 | |
| 14 | unsigned int test_lzcnt32(unsigned int __X) |
| 15 | { |
Craig Topper | 19b4a71 | 2011-12-25 15:20:31 +0000 | [diff] [blame] | 16 | // CHECK: @llvm.ctlz.i32 |
Craig Topper | 5c75208 | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 17 | return __lzcnt32(__X); |
| 18 | } |
| 19 | |
| 20 | unsigned long long test__lzcnt64(unsigned long long __X) |
| 21 | { |
Craig Topper | 19b4a71 | 2011-12-25 15:20:31 +0000 | [diff] [blame] | 22 | // CHECK: @llvm.ctlz.i64 |
Craig Topper | 5c75208 | 2011-12-25 06:25:37 +0000 | [diff] [blame] | 23 | return __lzcnt64(__X); |
| 24 | } |