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 @us = external global i16, align 2
11 @us_addr = external global i16*, align 8
12 @ui = external global i32, align 4
13 @ui_addr = external global i32*, align 8
15 define dso_local void @test_builtin_ppc_store2r() {
16 ; CHECK-64B-LABEL: test_builtin_ppc_store2r:
17 ; CHECK-64B: sthbrx 3, 0, 4
20 ; CHECK-32B-LABEL: test_builtin_ppc_store2r:
21 ; CHECK-32B: sthbrx 3, 0, 4
24 %0 = load i16, i16* @us, align 2
25 %conv = zext i16 %0 to i32
26 %1 = load i16*, i16** @us_addr, align 8
27 %2 = bitcast i16* %1 to i8*
28 call void @llvm.ppc.store2r(i32 %conv, i8* %2)
32 declare void @llvm.ppc.store2r(i32, i8*)
34 define dso_local void @test_builtin_ppc_store4r() {
35 ; CHECK-64B-LABEL: test_builtin_ppc_store4r:
36 ; CHECK-64B: stwbrx 3, 0, 4
39 ; CHECK-32B-LABEL: test_builtin_ppc_store4r:
40 ; CHECK-32B: stwbrx 3, 0, 4
43 %0 = load i32, i32* @ui, align 4
44 %1 = load i32*, i32** @ui_addr, align 8
45 %2 = bitcast i32* %1 to i8*
46 call void @llvm.ppc.store4r(i32 %0, i8* %2)
50 declare void @llvm.ppc.store4r(i32, i8*)
52 define dso_local zeroext i16 @test_builtin_ppc_load2r() {
53 ; CHECK-64B-LABEL: test_builtin_ppc_load2r:
54 ; CHECK-64B: lhbrx 3, 0, 3
55 ; CHECK-64B-NEXT: clrldi 3, 3, 48
58 ; CHECK-32B-LABEL: test_builtin_ppc_load2r:
59 ; CHECK-32B: lhbrx 3, 0, 3
60 ; CHECK-32B-NEXT: clrlwi 3, 3, 16
63 %0 = load i16*, i16** @us_addr, align 8
64 %1 = bitcast i16* %0 to i8*
65 %2 = call i32 @llvm.ppc.load2r(i8* %1)
66 %conv = trunc i32 %2 to i16
70 declare i32 @llvm.ppc.load2r(i8*)
72 define dso_local zeroext i32 @test_builtin_ppc_load4r() {
73 ; CHECK-64B-LABEL: test_builtin_ppc_load4r:
74 ; CHECK-64B: lwbrx 3, 0, 3
77 ; CHECK-32B-LABEL: test_builtin_ppc_load4r:
78 ; CHECK-32B: lwbrx 3, 0, 3
81 %0 = load i32*, i32** @ui_addr, align 8
82 %1 = bitcast i32* %0 to i8*
83 %2 = call i32 @llvm.ppc.load4r(i8* %1)
87 declare i32 @llvm.ppc.load4r(i8*)