Skip to content

Commit 0885740

Browse files
el-evmshockwave
andauthored
[RISCV] Create disjoint or in RISCVGatherScatterLowering (#151981)
We can create disjoint or in IRBuilder since #146350. --------- Co-authored-by: Min-Yih Hsu <[email protected]>
1 parent 12568b6 commit 0885740

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ static std::pair<Value *, Value *> matchStridedStart(Value *Start,
167167
default:
168168
llvm_unreachable("Unexpected opcode");
169169
case Instruction::Or:
170-
// TODO: We'd be better off creating disjoint or here, but we don't yet
171-
// have an IRBuilder API for that.
172-
[[fallthrough]];
170+
Start = Builder.CreateOr(Start, Splat, "", /*IsDisjoint=*/true);
171+
break;
173172
case Instruction::Add:
174173
Start = Builder.CreateAdd(Start, Splat);
175174
break;

llvm/test/CodeGen/RISCV/rvv/strided-load-store.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ define <vscale x 1 x i64> @straightline_offset_disjoint_or_1(ptr %p) {
467467
define <vscale x 1 x i64> @straightline_offset_disjoint_or(ptr %p, i1 %offset) {
468468
; CHECK-LABEL: @straightline_offset_disjoint_or(
469469
; CHECK-NEXT: [[AND:%.*]] = zext i1 [[OFFSET:%.*]] to i64
470-
; CHECK-NEXT: [[TMP4:%.*]] = add i64 4, [[AND]]
470+
; CHECK-NEXT: [[TMP4:%.*]] = or disjoint i64 4, [[AND]]
471471
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 [[TMP4]]
472472
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @llvm.vscale.i32()
473473
; CHECK-NEXT: [[TMP3:%.*]] = call <vscale x 1 x i64> @llvm.experimental.vp.strided.load.nxv1i64.p0.i64(ptr [[TMP1]], i64 8, <vscale x 1 x i1> splat (i1 true), i32 [[TMP2]])

0 commit comments

Comments
 (0)