| 1 |
// REQUIRES: powerpc-registered-target |
| 2 |
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -O1 -disable-llvm-passes \ |
| 3 |
// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix=64BIT |
| 4 |
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -O1 -disable-llvm-passes \ |
| 5 |
// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s --check-prefix=64BIT |
| 6 |
// RUN: %clang_cc1 -triple powerpc64-unknown-aix -O1 -disable-llvm-passes \ |
| 7 |
// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix=64BIT |
| 8 |
// RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu -O1 -disable-llvm-passes \ |
| 9 |
// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix=32BIT |
| 10 |
// RUN: %clang_cc1 -triple powerpcle-unknown-linux-gnu -O1 -disable-llvm-passes \ |
| 11 |
// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s --check-prefix=32BIT |
| 12 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -O1 -disable-llvm-passes \ |
| 13 |
// RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix=32BIT |
| 14 |
|
| 15 |
// 64BIT-LABEL: @testbuiltin_expect( |
| 16 |
// 64BIT: [[EXPVAL:%.*]] = call i64 @llvm.expect.i64(i64 {{%.*}}, i64 23) |
| 17 |
// 64BIT-NEXT: [[CMP:%.*]] = icmp eq i64 [[EXPVAL]], 23 |
| 18 |
// 64BIT-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 |
| 19 |
// 64BIT-NEXT: [[CONV1:%.*]] = sext i32 [[CONV]] to i64 |
| 20 |
// 64BIT-NEXT: ret i64 [[CONV1]] |
| 21 |
// |
| 22 |
// 32BIT-LABEL: @testbuiltin_expect( |
| 23 |
// 32BIT: [[EXPVAL:%.*]] = call i32 @llvm.expect.i32(i32 {{%.*}}, i32 23) |
| 24 |
// 32BIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[EXPVAL]], 23 |
| 25 |
// 32BIT-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32 |
| 26 |
// 32BIT-NEXT: ret i32 [[CONV]] |
| 27 |
// |
| 28 |
long testbuiltin_expect(long expression) { |
| 29 |
// The second parameter is a long constant. |
| 30 |
return __builtin_expect(expression, 23) == 23; |
| 31 |
} |