1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
2 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-64B
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
4 ; RUN: -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-64B
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
6 ; RUN: -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-32B
7 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
8 ; RUN: -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-64B
10 @ui = external global i32, align 4
11 @ull = external global i64, align 8
13 define dso_local signext i32 @test_builtin_ppc_poppar4() {
14 ; CHECK-32B-LABEL: test_builtin_ppc_poppar4:
15 ; CHECK-32B: popcntw 3, 3
16 ; CHECK-32B-NEXT: clrlwi 3, 3, 31
18 ; CHECK-64B-LABEL: test_builtin_ppc_poppar4:
19 ; CHECK-64B: popcntw 3, 3
20 ; CHECK-64B-NEXT: clrlwi 3, 3, 31
23 %0 = load i32, ptr @ui, align 4
24 %1 = load i32, ptr @ui, align 4
25 %2 = call i32 @llvm.ctpop.i32(i32 %1)
30 declare i32 @llvm.ctpop.i32(i32)
32 define dso_local signext i32 @test_builtin_ppc_poppar8() {
33 ; CHECK-32B-LABEL: test_builtin_ppc_poppar8:
34 ; CHECK-32B: xor 3, 3, 4
35 ; CHECK-32B-NEXT: popcntw 3, 3
36 ; CHECK-32B-NEXT: clrlwi 3, 3, 31
38 ; CHECK-64B-LABEL: test_builtin_ppc_poppar8:
39 ; CHECK-64B: popcntd 3, 3
40 ; CHECK-64B-NEXT: clrldi 3, 3, 63
43 %0 = load i64, ptr @ull, align 8
44 %1 = load i64, ptr @ull, align 8
45 %2 = call i64 @llvm.ctpop.i64(i64 %1)
47 %cast = trunc i64 %3 to i32
51 declare i64 @llvm.ctpop.i64(i64)