From cfc256ba9f6aa9d6aa29db91a98d35fa1f075596 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 17 Mar 2021 14:26:25 +0000 Subject: [PATCH] [DAG] TargetLowering::isBinOp() - add ISD::SSUBSAT/USUBSAT Add to the generic non-commutative binop list. --- llvm/include/llvm/CodeGen/TargetLowering.h | 2 ++ llvm/test/CodeGen/AMDGPU/ssubsat.ll | 2 +- llvm/test/CodeGen/AMDGPU/usubsat.ll | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index 0d2453a..05cc381 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -2458,6 +2458,8 @@ public: case ISD::UDIV: case ISD::SREM: case ISD::UREM: + case ISD::SSUBSAT: + case ISD::USUBSAT: case ISD::FSUB: case ISD::FDIV: case ISD::FREM: diff --git a/llvm/test/CodeGen/AMDGPU/ssubsat.ll b/llvm/test/CodeGen/AMDGPU/ssubsat.ll index 5ec6023..4aede12 100644 --- a/llvm/test/CodeGen/AMDGPU/ssubsat.ll +++ b/llvm/test/CodeGen/AMDGPU/ssubsat.ll @@ -226,8 +226,8 @@ define <3 x i16> @v_ssubsat_v3i16(<3 x i16> %lhs, <3 x i16> %rhs) { ; GFX9-LABEL: v_ssubsat_v3i16: ; GFX9: ; %bb.0: ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: v_pk_sub_i16 v0, v0, v2 clamp ; GFX9-NEXT: v_pk_sub_i16 v1, v1, v3 clamp +; GFX9-NEXT: v_pk_sub_i16 v0, v0, v2 clamp ; GFX9-NEXT: s_setpc_b64 s[30:31] %result = call <3 x i16> @llvm.ssub.sat.v3i16(<3 x i16> %lhs, <3 x i16> %rhs) ret <3 x i16> %result diff --git a/llvm/test/CodeGen/AMDGPU/usubsat.ll b/llvm/test/CodeGen/AMDGPU/usubsat.ll index eeabd31..13f61b6 100644 --- a/llvm/test/CodeGen/AMDGPU/usubsat.ll +++ b/llvm/test/CodeGen/AMDGPU/usubsat.ll @@ -147,8 +147,8 @@ define <3 x i16> @v_usubsat_v3i16(<3 x i16> %lhs, <3 x i16> %rhs) { ; GFX9-LABEL: v_usubsat_v3i16: ; GFX9: ; %bb.0: ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: v_pk_sub_u16 v0, v0, v2 clamp ; GFX9-NEXT: v_pk_sub_u16 v1, v1, v3 clamp +; GFX9-NEXT: v_pk_sub_u16 v0, v0, v2 clamp ; GFX9-NEXT: s_setpc_b64 s[30:31] %result = call <3 x i16> @llvm.usub.sat.v3i16(<3 x i16> %lhs, <3 x i16> %rhs) ret <3 x i16> %result -- 2.7.4