Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
      2 
      3 int leading, trailing, pop;
      4 
      5 void test_i16(short P) {
      6   leading = __builtin_clzs(P);
      7   trailing = __builtin_ctzs(P);
      8 
      9 // CHECK: @test_i16
     10 // CHECK: call i16 @llvm.ctlz.i16
     11 // CHECK: call i16 @llvm.cttz.i16
     12 }
     13 
     14 void test_i32(int P) {
     15   leading = __builtin_clz(P);
     16   trailing = __builtin_ctz(P);
     17   pop = __builtin_popcount(P);
     18 
     19 // CHECK: @test_i32
     20 // CHECK: call i32 @llvm.ctlz.i32
     21 // CHECK: call i32 @llvm.cttz.i32
     22 // CHECK: call i32 @llvm.ctpop.i32
     23 }
     24 
     25 void test_i64(float P) {
     26   leading = __builtin_clzll(P);
     27   trailing = __builtin_ctzll(P);
     28   pop = __builtin_popcountll(P);
     29 // CHECK: @test_i64
     30 // CHECK: call i64 @llvm.ctlz.i64
     31 // CHECK: call i64 @llvm.cttz.i64
     32 // CHECK: call i64 @llvm.ctpop.i64
     33 }
     34