diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td @@ -269,7 +269,20 @@ defm : VPatBinarySDNode_VV_VX; -def NegImm64 : SDNodeXFormgetTargetConstant(0x7 & (64 - N->getZExtValue()), SDLoc(N), + N->getValueType(0)); +}]>; +def InvRot16Imm : SDNodeXFormgetTargetConstant(0xf & (64 - N->getZExtValue()), SDLoc(N), + N->getValueType(0)); +}]>; +def InvRot32Imm : SDNodeXFormgetTargetConstant(0x1f & (64 - N->getZExtValue()), SDLoc(N), + N->getValueType(0)); +}]>; +def InvRot64Imm : SDNodeXFormgetTargetConstant(0x3f & (64 - N->getZExtValue()), SDLoc(N), N->getValueType(0)); }]>; @@ -284,7 +297,7 @@ (!cast("PseudoVROR_VI_"#vti.LMul.MX) (vti.Vector (IMPLICIT_DEF)), vti.RegClass:$rs2, - (NegImm64 uimm6:$rs1), + (!cast("InvRot" # vti.SEW # "Imm") uimm6:$rs1), vti.AVL, vti.Log2SEW, TA_MA)>; } } diff --git a/llvm/test/CodeGen/RISCV/rvv/vror-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vror-sdnode.ll --- a/llvm/test/CodeGen/RISCV/rvv/vror-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vror-sdnode.ll @@ -82,7 +82,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv1i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, mf8, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv1i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -166,7 +166,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv2i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, mf4, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv2i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -250,7 +250,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv4i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, mf2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv4i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -334,7 +334,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv8i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, m1, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv8i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -418,7 +418,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv16i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, m2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv16i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -502,7 +502,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv32i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, m4, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv32i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -586,7 +586,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv64i8: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e8, m8, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 7 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv64i8( %a, %a, shufflevector( insertelement( poison, i8 1, i32 0), poison, zeroinitializer)) ret %x @@ -670,7 +670,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv1i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, mf4, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv1i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -754,7 +754,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv2i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, mf2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv2i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -838,7 +838,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv4i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, m1, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv4i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -922,7 +922,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv8i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, m2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv8i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -1006,7 +1006,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv16i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, m4, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv16i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -1090,7 +1090,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv32i16: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e16, m8, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 15 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv32i16( %a, %a, shufflevector( insertelement( poison, i16 1, i32 0), poison, zeroinitializer)) ret %x @@ -1187,7 +1187,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv1i32: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e32, mf2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 31 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv1i32( %a, %a, shufflevector( insertelement( poison, i32 1, i32 0), poison, zeroinitializer)) ret %x @@ -1284,7 +1284,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv2i32: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e32, m1, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 31 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv2i32( %a, %a, shufflevector( insertelement( poison, i32 1, i32 0), poison, zeroinitializer)) ret %x @@ -1381,7 +1381,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv4i32: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e32, m2, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 31 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv4i32( %a, %a, shufflevector( insertelement( poison, i32 1, i32 0), poison, zeroinitializer)) ret %x @@ -1478,7 +1478,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv8i32: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e32, m4, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 31 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv8i32( %a, %a, shufflevector( insertelement( poison, i32 1, i32 0), poison, zeroinitializer)) ret %x @@ -1575,7 +1575,7 @@ ; CHECK-ZVBB-LABEL: vror_vi_rotl_nxv16i32: ; CHECK-ZVBB: # %bb.0: ; CHECK-ZVBB-NEXT: vsetvli a0, zero, e32, m8, ta, ma -; CHECK-ZVBB-NEXT: vror.vi v8, v8, 63 +; CHECK-ZVBB-NEXT: vror.vi v8, v8, 31 ; CHECK-ZVBB-NEXT: ret %x = call @llvm.fshl.nxv16i32( %a, %a, shufflevector( insertelement( poison, i32 1, i32 0), poison, zeroinitializer)) ret %x