You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The primary goal of this change is to simplify code, but it also
ends up being slightly more powerful. Rather than repeating the
gather/scatter of splat logic in both CGP and SDAG, generalize the
SDAG copy slightly and delete the CGP version.
The X86 codegen diffs are improvements - we were scaling a zero
value by 4, whereas now we're not scaling it. This codegen can
likely be further improved, but that'll be in upcoming patches.
Copy file name to clipboardExpand all lines: llvm/test/Transforms/CodeGenPrepare/AArch64/gather-scatter-opt-inseltpoison.ll
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,8 @@ define <vscale x 4 x i32> @global_struct_splat(<vscale x 4 x i1> %mask) #0 {
85
85
86
86
define <vscale x 4 x i32> @splat_ptr_gather(ptr%ptr, <vscale x 4 x i1> %mask, <vscale x 4 x i32> %passthru) #0 {
87
87
; CHECK-LABEL: @splat_ptr_gather(
88
-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[PTR:%.*]], <vscale x 4 x i64> zeroinitializer
88
+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <vscale x 4 x ptr> poison, ptr [[PTR:%.*]], i32 0
89
+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <vscale x 4 x ptr> [[TMP3]], <vscale x 4 x ptr> poison, <vscale x 4 x i32> zeroinitializer
89
90
; CHECK-NEXT: [[TMP2:%.*]] = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> [[TMP1]], i32 4, <vscale x 4 x i1> [[MASK:%.*]], <vscale x 4 x i32> [[PASSTHRU:%.*]])
90
91
; CHECK-NEXT: ret <vscale x 4 x i32> [[TMP2]]
91
92
;
@@ -97,7 +98,8 @@ define <vscale x 4 x i32> @splat_ptr_gather(ptr %ptr, <vscale x 4 x i1> %mask, <
97
98
98
99
definevoid@splat_ptr_scatter(ptr%ptr, <vscale x 4 x i1> %mask, <vscale x 4 x i32> %val) #0 {
99
100
; CHECK-LABEL: @splat_ptr_scatter(
100
-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[PTR:%.*]], <vscale x 4 x i64> zeroinitializer
101
+
; CHECK-NEXT: [[TMP2:%.*]] = insertelement <vscale x 4 x ptr> poison, ptr [[PTR:%.*]], i32 0
102
+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <vscale x 4 x ptr> [[TMP2]], <vscale x 4 x ptr> poison, <vscale x 4 x i32> zeroinitializer
101
103
; CHECK-NEXT: call void @llvm.masked.scatter.nxv4i32.nxv4p0(<vscale x 4 x i32> [[VAL:%.*]], <vscale x 4 x ptr> [[TMP1]], i32 4, <vscale x 4 x i1> [[MASK:%.*]])
Copy file name to clipboardExpand all lines: llvm/test/Transforms/CodeGenPrepare/AArch64/gather-scatter-opt.ll
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,8 @@ define <vscale x 4 x i32> @global_struct_splat(<vscale x 4 x i1> %mask) #0 {
85
85
86
86
define <vscale x 4 x i32> @splat_ptr_gather(ptr%ptr, <vscale x 4 x i1> %mask, <vscale x 4 x i32> %passthru) #0 {
87
87
; CHECK-LABEL: @splat_ptr_gather(
88
-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[PTR:%.*]], <vscale x 4 x i64> zeroinitializer
88
+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <vscale x 4 x ptr> undef, ptr [[PTR:%.*]], i32 0
89
+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <vscale x 4 x ptr> [[TMP3]], <vscale x 4 x ptr> undef, <vscale x 4 x i32> zeroinitializer
89
90
; CHECK-NEXT: [[TMP2:%.*]] = call <vscale x 4 x i32> @llvm.masked.gather.nxv4i32.nxv4p0(<vscale x 4 x ptr> [[TMP1]], i32 4, <vscale x 4 x i1> [[MASK:%.*]], <vscale x 4 x i32> [[PASSTHRU:%.*]])
90
91
; CHECK-NEXT: ret <vscale x 4 x i32> [[TMP2]]
91
92
;
@@ -97,7 +98,8 @@ define <vscale x 4 x i32> @splat_ptr_gather(ptr %ptr, <vscale x 4 x i1> %mask, <
97
98
98
99
definevoid@splat_ptr_scatter(ptr%ptr, <vscale x 4 x i1> %mask, <vscale x 4 x i32> %val) #0 {
99
100
; CHECK-LABEL: @splat_ptr_scatter(
100
-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[PTR:%.*]], <vscale x 4 x i64> zeroinitializer
101
+
; CHECK-NEXT: [[TMP2:%.*]] = insertelement <vscale x 4 x ptr> undef, ptr [[PTR:%.*]], i32 0
102
+
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <vscale x 4 x ptr> [[TMP2]], <vscale x 4 x ptr> undef, <vscale x 4 x i32> zeroinitializer
101
103
; CHECK-NEXT: call void @llvm.masked.scatter.nxv4i32.nxv4p0(<vscale x 4 x i32> [[VAL:%.*]], <vscale x 4 x ptr> [[TMP1]], i32 4, <vscale x 4 x i1> [[MASK:%.*]])
0 commit comments