diff --git a/llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td index c851b1b6f5eb7..898e0183f3b0c 100644 --- a/llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td +++ b/llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td @@ -1404,10 +1404,12 @@ def : Pat<(and (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm))), // XVORI_B def : Pat<(or (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm))), (XVORI_B LASX256:$xj, uimm8:$imm)>; - // XVXORI_B def : Pat<(xor (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm))), (XVXORI_B LASX256:$xj, uimm8:$imm)>; +// XVNORI_B +def : Pat<(vnot (or (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm)))), + (XVNORI_B LASX256:$xj, uimm8:$imm)>; // XVBSLL_V foreach vt = [v32i8, v16i16, v8i32, v4i64, v8f32, diff --git a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td index fe7c47543424b..571f952c567d0 100644 --- a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td +++ b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td @@ -1598,10 +1598,12 @@ def : Pat<(and (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))), // VORI_B def : Pat<(or (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))), (VORI_B LSX128:$vj, uimm8:$imm)>; - // VXORI_B def : Pat<(xor (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))), (VXORI_B LSX128:$vj, uimm8:$imm)>; +// VNORI_B +def : Pat<(vnot (or (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm)))), + (VNORI_B LSX128:$vj, uimm8:$imm)>; // VBSLL_V foreach vt = [v16i8, v8i16, v4i32, v2i64, v4f32, diff --git a/llvm/test/CodeGen/LoongArch/lasx/ir-instruction/nor.ll b/llvm/test/CodeGen/LoongArch/lasx/ir-instruction/nor.ll index 62ca303475241..5050b6b0ccddc 100644 --- a/llvm/test/CodeGen/LoongArch/lasx/ir-instruction/nor.ll +++ b/llvm/test/CodeGen/LoongArch/lasx/ir-instruction/nor.ll @@ -74,8 +74,7 @@ define void @nor_u_v32i8(ptr %res, ptr %a0) nounwind { ; CHECK-LABEL: nor_u_v32i8: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xvld $xr0, $a1, 0 -; CHECK-NEXT: xvrepli.b $xr1, 31 -; CHECK-NEXT: xvnor.v $xr0, $xr0, $xr1 +; CHECK-NEXT: xvnori.b $xr0, $xr0, 31 ; CHECK-NEXT: xvst $xr0, $a0, 0 ; CHECK-NEXT: ret entry: diff --git a/llvm/test/CodeGen/LoongArch/lsx/ir-instruction/nor.ll b/llvm/test/CodeGen/LoongArch/lsx/ir-instruction/nor.ll index a2c15b28f8827..fc3e1645a0594 100644 --- a/llvm/test/CodeGen/LoongArch/lsx/ir-instruction/nor.ll +++ b/llvm/test/CodeGen/LoongArch/lsx/ir-instruction/nor.ll @@ -74,8 +74,7 @@ define void @nor_u_v16i8(ptr %res, ptr %a0) nounwind { ; CHECK-LABEL: nor_u_v16i8: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vld $vr0, $a1, 0 -; CHECK-NEXT: vrepli.b $vr1, 31 -; CHECK-NEXT: vnor.v $vr0, $vr0, $vr1 +; CHECK-NEXT: vnori.b $vr0, $vr0, 31 ; CHECK-NEXT: vst $vr0, $a0, 0 ; CHECK-NEXT: ret entry: