brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · f2934a1 Raw
83 lines · c
1// REQUIRES: powerpc-registered-target2// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \3// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s4// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \5// RUN:   -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s6// RUN: %clang_cc1 -triple powerpc-unknown-aix \7// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s8// RUN: %clang_cc1 -triple powerpc64-unknown-aix \9// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s10 11extern unsigned int ui;12extern unsigned long long ull;13 14// CHECK-LABEL: @test_builtin_ppc_poppar4(15// CHECK:         [[TMP2:%.*]] = call i32 @llvm.ctpop.i32(i32 {{.*}})16// CHECK-NEXT:    [[TMP3:%.*]] = and i32 [[TMP2]], 117// CHECK-NEXT:    ret i32 [[TMP3]]18//19int test_builtin_ppc_poppar4() {20 return __builtin_ppc_poppar4(ui);21}22 23// CHECK-LABEL: @test_builtin_ppc_poppar8(24// CHECK:         [[TMP2:%.*]] = call i64 @llvm.ctpop.i64(i64 {{.*}})25// CHECK-NEXT:    [[TMP3:%.*]] = and i64 [[TMP2]], 126// CHECK-NEXT:    [[CAST:%.*]] = trunc i64 [[TMP3]] to i3227// CHECK-NEXT:    ret i32 [[CAST]]28//29int test_builtin_ppc_poppar8() {30 return __builtin_ppc_poppar8(ull);31}32 33// CHECK-LABEL: @testcntlz4(34// CHECK:         [[TMP:%.*]] = call i32 @llvm.ctlz.i32(i32 {{%.*}}, i1 false)35// CHECK-NEXT:    ret i32 [[TMP]]36//37unsigned int testcntlz4(unsigned int value) {38  return __cntlz4(value);39}40 41// CHECK-LABEL: @testcntlz8(42// CHECK:         [[TMP:%.*]] = call i64 @llvm.ctlz.i64(i64 {{%.*}}, i1 false)43// CHECK-NEXT:    [[CAST:%.*]] = trunc i64 [[TMP]] to i3244// CHECK-NEXT:    ret i32 [[CAST]]45//46unsigned int testcntlz8(unsigned long long value) {47  return __cntlz8(value);48}49 50// CHECK-LABEL: @testcnttz4(51// CHECK:         [[TMP:%.*]] = call i32 @llvm.cttz.i32(i32 {{%.*}}, i1 false)52// CHECK-NEXT:    ret i32 [[TMP]]53//54unsigned int testcnttz4(unsigned int value) {55  return __cnttz4(value);56}57 58// CHECK-LABEL: @testcnttz8(59// CHECK:         [[TMP:%.*]] = call i64 @llvm.cttz.i64(i64 {{%.*}}, i1 false)60// CHECK-NEXT:    [[CAST:%.*]] = trunc i64 [[TMP]] to i3261// CHECK-NEXT:    ret i32 [[CAST]]62//63unsigned int testcnttz8(unsigned long long value) {64  return __cnttz8(value);65}66 67// CHECK-LABEL: @testpopcnt4(68// CHECK:         [[TMP:%.*]] = call i32 @llvm.ctpop.i32(i32 {{%.*}})69// CHECK-NEXT:    ret i32 [[TMP]]70//71int testpopcnt4(unsigned int value) {72  return __popcnt4(value);73}74 75// CHECK-LABEL: @testpopcnt8(76// CHECK:         [[TMP:%.*]] = call i64 @llvm.ctpop.i64(i64 {{%.*}})77// CHECK-NEXT:    [[CAST:%.*]] = trunc i64 [[TMP]] to i3278// CHECK-NEXT:    ret i32 [[CAST]]79//80int testpopcnt8(unsigned long long value) {81  return __popcnt8(value);82}83