• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -codegenprepare -mtriple=powerpc64-unknown-linux-gnu -data-layout="E-m:e-i64:64-n32:64" -force-split-store < %s  | FileCheck --check-prefix=BE %s
3; RUN: opt -S -codegenprepare -mtriple=powerpc64le-unknown-linux-gnu -data-layout="e-m:e-i64:64-n32:64" -force-split-store < %s  | FileCheck --check-prefix=LE %s
4
5define void @split_store_align1(float %x, i64* %p) {
6; BE-LABEL: @split_store_align1(
7; BE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
8; BE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
9; BE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
10; BE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
11; BE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
12; BE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
13; BE-NEXT:    [[TMP2:%.*]] = getelementptr i32, i32* [[TMP1]], i32 1
14; BE-NEXT:    store i32 [[B]], i32* [[TMP2]], align 1
15; BE-NEXT:    [[TMP3:%.*]] = bitcast i64* [[P]] to i32*
16; BE-NEXT:    store i32 0, i32* [[TMP3]], align 1
17; BE-NEXT:    ret void
18;
19; LE-LABEL: @split_store_align1(
20; LE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
21; LE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
22; LE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
23; LE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
24; LE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
25; LE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
26; LE-NEXT:    store i32 [[B]], i32* [[TMP1]], align 1
27; LE-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
28; LE-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
29; LE-NEXT:    store i32 0, i32* [[TMP3]], align 1
30; LE-NEXT:    ret void
31;
32  %b = bitcast float %x to i32
33  %z = zext i32 0 to i64
34  %s = shl nuw nsw i64 %z, 32
35  %z2 = zext i32 %b to i64
36  %o = or i64 %s, %z2
37  store i64 %o, i64* %p, align 1
38  ret void
39}
40
41define void @split_store_align2(float %x, i64* %p) {
42; BE-LABEL: @split_store_align2(
43; BE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
44; BE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
45; BE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
46; BE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
47; BE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
48; BE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
49; BE-NEXT:    [[TMP2:%.*]] = getelementptr i32, i32* [[TMP1]], i32 1
50; BE-NEXT:    store i32 [[B]], i32* [[TMP2]], align 2
51; BE-NEXT:    [[TMP3:%.*]] = bitcast i64* [[P]] to i32*
52; BE-NEXT:    store i32 0, i32* [[TMP3]], align 2
53; BE-NEXT:    ret void
54;
55; LE-LABEL: @split_store_align2(
56; LE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
57; LE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
58; LE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
59; LE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
60; LE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
61; LE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
62; LE-NEXT:    store i32 [[B]], i32* [[TMP1]], align 2
63; LE-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
64; LE-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
65; LE-NEXT:    store i32 0, i32* [[TMP3]], align 2
66; LE-NEXT:    ret void
67;
68  %b = bitcast float %x to i32
69  %z = zext i32 0 to i64
70  %s = shl nuw nsw i64 %z, 32
71  %z2 = zext i32 %b to i64
72  %o = or i64 %s, %z2
73  store i64 %o, i64* %p, align 2
74  ret void
75}
76
77define void @split_store_align8(float %x, i64* %p) {
78; BE-LABEL: @split_store_align8(
79; BE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
80; BE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
81; BE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
82; BE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
83; BE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
84; BE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
85; BE-NEXT:    [[TMP2:%.*]] = getelementptr i32, i32* [[TMP1]], i32 1
86; BE-NEXT:    store i32 [[B]], i32* [[TMP2]], align 4
87; BE-NEXT:    [[TMP3:%.*]] = bitcast i64* [[P]] to i32*
88; BE-NEXT:    store i32 0, i32* [[TMP3]], align 8
89; BE-NEXT:    ret void
90;
91; LE-LABEL: @split_store_align8(
92; LE-NEXT:    [[B:%.*]] = bitcast float [[X:%.*]] to i32
93; LE-NEXT:    [[Z:%.*]] = zext i32 0 to i64
94; LE-NEXT:    [[S:%.*]] = shl nuw nsw i64 [[Z]], 32
95; LE-NEXT:    [[Z2:%.*]] = zext i32 [[B]] to i64
96; LE-NEXT:    [[O:%.*]] = or i64 [[S]], [[Z2]]
97; LE-NEXT:    [[TMP1:%.*]] = bitcast i64* [[P:%.*]] to i32*
98; LE-NEXT:    store i32 [[B]], i32* [[TMP1]], align 8
99; LE-NEXT:    [[TMP2:%.*]] = bitcast i64* [[P]] to i32*
100; LE-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[TMP2]], i32 1
101; LE-NEXT:    store i32 0, i32* [[TMP3]], align 4
102; LE-NEXT:    ret void
103;
104  %b = bitcast float %x to i32
105  %z = zext i32 0 to i64
106  %s = shl nuw nsw i64 %z, 32
107  %z2 = zext i32 %b to i64
108  %o = or i64 %s, %z2
109  store i64 %o, i64* %p, align 8
110  ret void
111}
112