Skip to content

Commit 1d9bea3

Browse files
committed
[RISCV] Correct getOperandLog2EEW for VCOMPRESS_VM.
1 parent 7fea6be commit 1d9bea3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,6 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
422422
case RISCV::VRGATHER_VI:
423423
case RISCV::VRGATHER_VV:
424424
case RISCV::VRGATHER_VX:
425-
// Vector Compress Instruction
426-
// EEW=SEW.
427-
case RISCV::VCOMPRESS_VM:
428425
// Vector Element Index Instruction
429426
case RISCV::VID_V:
430427
// Vector Single-Width Floating-Point Add/Subtract Instructions
@@ -674,6 +671,12 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
674671
return MILog2SEW;
675672
}
676673

674+
// Vector Compress Instruction
675+
// EEW=SEW except the mask operand has EEW=1. Mask operand is not handled
676+
// before this switch.
677+
case RISCV::VCOMPRESS_VM:
678+
return MO.getOperandNo() == 3 ? 0 : MILog2SEW;
679+
677680
// Vector Iota Instruction
678681
// EEW=SEW, except the mask operand has EEW=1. Mask operand is not handled
679682
// before this switch.

llvm/test/CodeGen/RISCV/rvv/vl-opt.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ define void @fadd_fcmp_select_copy(<vscale x 4 x float> %v, <vscale x 4 x i1> %c
202202
define <vscale x 8 x i32> @vcompress_cmp(<vscale x 8 x i32> %a, <vscale x 8 x i32> %b, <vscale x 8 x i32> %c, iXLen %vl) {
203203
; CHECK-LABEL: vcompress_cmp:
204204
; CHECK: # %bb.0:
205-
; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
206-
; CHECK-NEXT: vmseq.vv v20, v8, v12
207205
; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
206+
; CHECK-NEXT: vmseq.vv v20, v8, v12
208207
; CHECK-NEXT: vcompress.vm v8, v16, v20
209208
; CHECK-NEXT: ret
210209
%cmp = icmp eq <vscale x 8 x i32> %a, %b

0 commit comments

Comments
 (0)