From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1461) id 746003857BBC; Tue, 11 Oct 2022 11:01:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 746003857BBC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665486101; bh=2vGnEv1nafFP6GAxMOH2xYsNIkQtlX7Hkr4fInH7Qgo=; h=From:To:Subject:Date:From; b=qyR5ZyV59jOG1H9fr8uJJ9JgPo0Ebsx0wxLAzIpVbYS42/ME5DVUNVInLXLC7RUan hqySLXzB60GJG5Q92ExT53JNKUcxxsby/ED6tNLmvQnnXfMXgVgI+3cJCFmBtEYIqy G5s5z6xxFGTnmOjfF91h7RqEojDbMoee+wMpm1oU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Stubbs To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3221] amdgcn: Resolve insn conditions at compile time X-Act-Checkin: gcc X-Git-Author: Andrew Stubbs X-Git-Refname: refs/heads/master X-Git-Oldrev: 45381d6f9f4e7b5c7b062f5ad8cc9788091c2d07 X-Git-Newrev: 0d8753cf30486c4e7fb07455b7cae49aa812c6a4 Message-Id: <20221011110141.746003857BBC@sourceware.org> Date: Tue, 11 Oct 2022 11:01:41 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0d8753cf30486c4e7fb07455b7cae49aa812c6a4 commit r13-3221-g0d8753cf30486c4e7fb07455b7cae49aa812c6a4 Author: Andrew Stubbs Date: Thu Mar 26 21:22:45 2020 +0000 amdgcn: Resolve insn conditions at compile time GET_MODE_NUNITS isn't a compile time constant, so we end up with many impossible insns in the machine description. Adding MODE_VF allows the insns to be eliminated completely. gcc/ChangeLog: * config/gcn/gcn-valu.md (2): Use MODE_VF. (2): Likewise. * config/gcn/gcn.h (MODE_VF): New macro. Diff: --- gcc/config/gcn/gcn-valu.md | 10 ++++++---- gcc/config/gcn/gcn.h | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md index 52d2fcb880a..c7be2361164 100644 --- a/gcc/config/gcn/gcn-valu.md +++ b/gcc/config/gcn/gcn-valu.md @@ -2873,8 +2873,9 @@ [(set (match_operand:VCVT_FMODE 0 "register_operand" "= v") (cvt_op:VCVT_FMODE (match_operand:VCVT_MODE 1 "gcn_alu_operand" "vSvB")))] - "gcn_valid_cvt_p (mode, mode, - _cvt)" + "MODE_VF (mode) == MODE_VF (mode) + && gcn_valid_cvt_p (mode, mode, + _cvt)" "v_cvt\t%0, %1" [(set_attr "type" "vop1") (set_attr "length" "8")]) @@ -2883,8 +2884,9 @@ [(set (match_operand:VCVT_IMODE 0 "register_operand" "= v") (cvt_op:VCVT_IMODE (match_operand:VCVT_FMODE 1 "gcn_alu_operand" "vSvB")))] - "gcn_valid_cvt_p (mode, mode, - _cvt)" + "MODE_VF (mode) == MODE_VF (mode) + && gcn_valid_cvt_p (mode, mode, + _cvt)" "v_cvt\t%0, %1" [(set_attr "type" "vop1") (set_attr "length" "8")]) diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h index 318256c4a7a..38f7212db59 100644 --- a/gcc/config/gcn/gcn.h +++ b/gcc/config/gcn/gcn.h @@ -678,3 +678,27 @@ enum gcn_builtin_codes /* Trampolines */ #define TRAMPOLINE_SIZE 36 #define TRAMPOLINE_ALIGNMENT 64 + +/* MD Optimization. + The following are intended to be obviously constant at compile time to + allow genconditions to eliminate bad patterns at compile time. */ +#define MODE_VF(M) \ + ((M == V64QImode || M == V64HImode || M == V64HFmode || M == V64SImode \ + || M == V64SFmode || M == V64DImode || M == V64DFmode) \ + ? 64 \ + : (M == V32QImode || M == V32HImode || M == V32HFmode || M == V32SImode \ + || M == V32SFmode || M == V32DImode || M == V32DFmode) \ + ? 32 \ + : (M == V16QImode || M == V16HImode || M == V16HFmode || M == V16SImode \ + || M == V16SFmode || M == V16DImode || M == V16DFmode) \ + ? 16 \ + : (M == V8QImode || M == V8HImode || M == V8HFmode || M == V8SImode \ + || M == V8SFmode || M == V8DImode || M == V8DFmode) \ + ? 8 \ + : (M == V4QImode || M == V4HImode || M == V4HFmode || M == V4SImode \ + || M == V4SFmode || M == V4DImode || M == V4DFmode) \ + ? 4 \ + : (M == V2QImode || M == V2HImode || M == V2HFmode || M == V2SImode \ + || M == V2SFmode || M == V2DImode || M == V2DFmode) \ + ? 2 \ + : 1)