From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.143]) by sourceware.org (Postfix) with ESMTPS id 12E3E38582BE for ; Mon, 17 Jul 2023 09:03:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12E3E38582BE Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kalrayinc.com Received: from localhost (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id 0CD1C72F53F for ; Mon, 17 Jul 2023 11:03:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1689584624; bh=AQCd2aVOAztGtKjOkLZDoP1krUXgSNeiDkjs2hcmX+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f3He0h6LbR055OTxgC4mbGT6GB4CrJ+ARgiyy3fBBOIaaD0R67zupJD+aV34cEWgt m1y3BvahhpkU2h+jpMtx4b7ASWnBelcMZXfTNRJCaOOFMoYjl7bUW6Y6uqDB3UWUc/ Q5tHVs3rzGMqN7b0/9CcS9PySpCJwtBZW2Ccfxto= Received: from fx403 (localhost [127.0.0.1]) by fx403.security-mail.net (Postfix) with ESMTP id B31E272F343 for ; Mon, 17 Jul 2023 11:03:43 +0200 (CEST) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-pr2fra01lp0106.outbound.protection.outlook.com [104.47.24.106]) by fx403.security-mail.net (Postfix) with ESMTPS id B7E0672EEFC for ; Mon, 17 Jul 2023 11:03:42 +0200 (CEST) Received: from MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:11::21) by PAZP264MB3040.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1e7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Mon, 17 Jul 2023 09:03:41 +0000 Received: from MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM ([fe80::a854:17f0:8f2a:f6d9]) by MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM ([fe80::a854:17f0:8f2a:f6d9%4]) with mapi id 15.20.6588.031; Mon, 17 Jul 2023 09:03:41 +0000 X-Virus-Scanned: E-securemail Secumail-id: <83bd.64b503ee.b6c36.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FHA7CTFRaH9gIBrEMz2MLOBtiJIrpZajVKjHvwtDOlQm1E8vcf59ugmlfMrpA+yGmDoZKjmV0J96DzsDBojZbMkSssNmM1zGgG5cs6GN5azjD1gDsEOmk2r4/FTUbDuu0e+UttLOp58a9Nh9Ri01D0abqqHL0fLCz75op/4zPhs6bYtJnoerNtm+73f9EDTHNfLvG9S6MRIQ/IaAC5kWISvln4qihg0iv4/2UsLi1aa8XzdwTuPUUX0s+PVul4qwWPzflSVP5UDdrEtSBSugpS+8feBdmaRBvohcOxTON5hklmMBPWm0v1QDMl+YbR8Q2HscFyQTyf5jmQIbW9m92g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qNpw1f1ypf9TcjG1yXu7px/UBNxwH+AGw7S366mcoYo=; b=fAXJl2N6U67uw5qOLGlYFcvOERb7UENdq8CFRwjl+pDdS2W17VSh7XX4jJusM2wki50SzBylphR4Zg2CzNSpHvJO7mZ59hh5TGF/dmWI9b9A/qJXvZHQTCDoQzDiciYBns2Dn2xFdLBQX73ofgpY3YFXHCNmTEHgEmPlVtS50T9trKlkC1zzgUNoXbOeNuLHYAxG33VhEjNqkt3mYVXELI9sjR3bgKzWHit+y7+q+KGABBXJ9xc2vAZiJV4xlRHuMQVJVH1AkCY09c3MuFK2Y9NX36n3kAblycsXN4Ieb2pj7pOhb0OsTpL91P07xW+TQcdYUz/RiVa7GV3JhKXrSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qNpw1f1ypf9TcjG1yXu7px/UBNxwH+AGw7S366mcoYo=; b=U85msi9IZrBRq6uudG1JVtMlHvLohJtVDWDnC8YQ9vjVD4Efc6c1efyadWhv4gCUGu993JNcAubx41E2o5eI4IHpxlaJq+bcSYXqCUNLg8VN8a85BnpX2W3o50WqH5q4GhPOMF+5Ba1Wrz1AthFVE4Hewt1ZBUIN7QK3lMWm1WpB21WSc6sx9CSPtWfjjYI3Ud+X5J5C9hhX36hg19e7frKuvblkTZAN7vRoyCRtKlrqzIDhHuY9Jow0WHHPMWsHus8G1fJwooPSQtvRMvYnm60db87VtRn5L9xH8a9/Af+bEN5YBHRwGr12Oen5Fa39fDDk26YJYJ6QXjU8guy5sw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Sylvain Noiry To: gcc-patches@gcc.gnu.org Cc: Sylvain Noiry Subject: [PATCH 4/9] Native complex operations: Allow native complex regs and ops in rtl Date: Mon, 17 Jul 2023 11:02:45 +0200 Message-ID: <20230717090250.4645-5-snoiry@kalrayinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717090250.4645-1-snoiry@kalrayinc.com> References: <20230717090250.4645-1-snoiry@kalrayinc.com> X-ClientProxiedBy: LO2P265CA0307.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::31) To MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:11::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR2P264MB0113:EE_|PAZP264MB3040:EE_ X-MS-Office365-Filtering-Correlation-Id: 477d6251-d07b-4bd7-8df6-08db86a4b791 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dh7duCaNTNIXAWlFJRx2fNdgFDCIicUA/1rKIzmEKzxHmdiISgNQLsW+HlGhayyiJ8ksEptyo3RHYBQPJ5MjwAzCg1t4Akf4lEHwvdBOlolmwwQRnSeTkcmHpL+a/uAnsqbhow1grWy1yVJK3F04yEe4YwnLNmjbeFtP0QAWW8PU0Vrsr0HBuYQ+dGP0EUEk2sDf+khE0vZQWrffJmlRzZr80m1rG5k+2jzDyC5l7L57ae5EVGBfXfiM3u1MJgUXnMPdnaEYU65Alq4+m+d+o1sAG+Stdr3ExLjhi3ce8reDYO+IoiLcKIaitCpA3RibNUALiay9xycEuApHg00zCDYmrBUl7NngstG0klxjpVXj4JErG0+i6svgLS7CocOyCpAlJgazFBCKyw6bFj6R7dMsVrPAErQUSIf4gb/U5QMxDR/iM5dYbOmaHBy2sfwQBHKlrSbV/ILc/tLl6nJ33y9c8NWfr5LtGCrpUFPUvX1OZaz6YG2iC1dtyP5PRbgoKLfA0fFg1DfrcL9C/XocbpRSm1Al8aFpJvUhRdoNCX0eLtLdZSqf/zoD5UDcji7/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(346002)(136003)(39850400004)(376002)(451199021)(478600001)(6486002)(186003)(1076003)(6506007)(26005)(6512007)(107886003)(2906002)(41300700001)(316002)(6916009)(4326008)(66476007)(66946007)(66556008)(5660300002)(36756003)(8676002)(8936002)(38100700002)(86362001)(2616005)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zLkMHDnaXQD/WYlAYIUuw1tQyHGx1pOaswnlvFVgxKZk//Ret5r+ZfYRINDw0RuOGue5PTQqM6AGOIlbpAID+fRZ7fc6o15NFi71+3WUH356Ur2kUN3Mlh5j7OS9hYsCGaP9VVbYMod2WJg5lCPh1PnyUCTH9E5E9CmHV73wR+nzuEKQGgXHIqJ3TqptgIYQLp6bYbHAi3xPSRjze/uML9sywt/DKlhEIJ+xWEzKJbDjgMFdMDMsDrzyTa6+mm9haevtNHIyFXhZZgaIDCnR8gyUMvdBTYmakmmtz4eHipqAxh0I4VkfqI2D2esaPsepXZSZ3Vdu7pyk+QZGfKJlUhADKOJ9iaZKoKFsKNWmCC1z0j9gP1vrb9ZmBjkH0dxoFQ2rm54Id3NLfb9R2YqU2pg3ae+oM57BjbZLKq6FUDuz8yBzpSdRB9yaGETRglV3VLj4Bv71woPopAvEdNuLGsVGwf5oUmgeJ/B5t4XtR/2UPl8yojYek6xRmY5VAdmd6tQSNpE9lM4GUbLCktC6ToPgcyXmcj4VvOh3xxNCF6vLdhcPXA4SkgyUv1+GMjZR180CGdQ0bH6HHIThCQwjTnMerlmc02Lk5oih3h6+zd2VaexJ3EkzNmJiTPwuBnWCuz8CyWiGKNWG15W0dpVvoNzM0fMsb0/X+ZWJkD7Jm4iWvnjqT+lblehgiGJ9LG4NEB3g7EnaLiEyvR8u5AmX7UfKuPYXLRE39iv1S0xU3n5+k6s/3dFRKy5CXOWPI/a5VCQLapUP6Bt2iyv40rk/KVTfJ7l4kQWeFPQf+v4DkON5F2tlWEhr5uCh9rdL4g6pnCD30Ii+URkMP/m4qpAlNPsYDhlW2MGv4wZapvcTsM7Oce5HAd9UdM9Iv+kRe3j4lr7sCY5NXQ9cLo6LidtyFJMYnweOsqPmoCH1fTPETTD2I6KP7Lj5zdF7xFJrW0Eo rmxdXttQZjcKB4WK5OoSdj9qonhWWmaqUDXwxP9Y2iEtTyFb/Yjog2kJ3aCZOVfB8enegaTAr6zspUpQLxsbgF9ApduPgnbwq7T2FFhhqShuzT1Zeo2fLxjV3jAJiMtB7ResbmkYeoxUJYSY2Uvi5TmxXO4pNP4OOTLRGSDayC8UdofP16D0xuCzsQ/NOh+czj1Fd5SHwtA2Gg1Ks4aoK8EQCLlcqNgE0lFUQBwHZfooyo//ckgOAVPcyMci6kxvJOYzzuELnyzNBSiS0a21l4xqXlbjhXBRSrCo1BWGdQP58MnaSAYZcKQXiC0uUVYR7M89I3IqaYx7lfT13SLilwC/BUoUrnFV4Rqk3/cP3/CQDplzTLGoE1MMiQh2eujTcyhtPyvSLdghDmN3KwVClugrnSpF9LpG977H/sEmqjqWjnEL6Dir+rcjWigkz5mZNfmhQ3klBI1BQcZoKkhk4oHMOG5MGBsD+kN/8JQGzAUpJxBzsSz9jFIW4n3B3F1t2zpeOrOZSH2gnCrfJlkKD82A+9hcFcqivIZ7gP4Mhkvss6TgLmvXOzU8th4UZt//RQXiUWldWqBYuzAELYvembkWW8qDlNYHP9IB2KzzFuwtwmQQm7lLvENOH3gzWTsC X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 477d6251-d07b-4bd7-8df6-08db86a4b791 X-MS-Exchange-CrossTenant-AuthSource: MR2P264MB0113.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 09:03:41.6579 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /CHw0c10N0VQH/yU+tdQ8RLAds09ZPOU2V9ubVAcvtMzd6U2s3ISIa0swxUaJUqJHVFJESPfj8B+VYYnhjcQ1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB3040 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Support registers of complex types in rtl. Also adapt the functions called during the expand pass to support native complex operations. gcc/ChangeLog: * explow.cc (trunc_int_for_mode): Allow complex int modes * expr.cc (emit_move_complex_parts): Move both parts at the same time if it is supported by the backend (emit_move_complex): Do not move via integer if not int mode corresponds. For complex floats, relax the constraint on the number of registers for targets with pairs of registers, and use native moves if it is supported by the backend. (expand_expr_real_2): Move both parts at the same time if it is supported by the backend (expand_expr_real_1): Update the expand of complex constants (const_vector_from_tree): Add the expand of both parts of a complex constant * real.h: update FLOAT_MODE_FORMAT * machmode.h: Add COMPLEX_INT_MODE_P and COMPLEX_FLOAT_MODE_P predicates * optabs-libfuncs.cc (gen_int_libfunc): Add support for complex modes (gen_intv_fp_libfunc): Likewise * recog.cc (general_operand): Likewise --- gcc/explow.cc | 2 +- gcc/expr.cc | 84 ++++++++++++++++++++++++++++++++++++------ gcc/machmode.h | 6 +++ gcc/optabs-libfuncs.cc | 29 ++++++++++++--- gcc/real.h | 3 +- gcc/recog.cc | 1 + 6 files changed, 105 insertions(+), 20 deletions(-) diff --git a/gcc/explow.cc b/gcc/explow.cc index 6424c0802f0..48572a40eab 100644 --- a/gcc/explow.cc +++ b/gcc/explow.cc @@ -56,7 +56,7 @@ trunc_int_for_mode (HOST_WIDE_INT c, machine_mode mode) int width = GET_MODE_PRECISION (smode); /* You want to truncate to a _what_? */ - gcc_assert (SCALAR_INT_MODE_P (mode)); + gcc_assert (SCALAR_INT_MODE_P (mode) || COMPLEX_INT_MODE_P (mode)); /* Canonicalize BImode to 0 and STORE_FLAG_VALUE. */ if (smode == BImode) diff --git a/gcc/expr.cc b/gcc/expr.cc index e1a0892b4d9..e94de8a05b5 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -3847,8 +3847,14 @@ emit_move_complex_parts (rtx x, rtx y) && REG_P (x) && !reg_overlap_mentioned_p (x, y)) emit_clobber (x); - write_complex_part (x, read_complex_part (y, REAL_P), REAL_P, true); - write_complex_part (x, read_complex_part (y, IMAG_P), IMAG_P, false); + machine_mode mode = GET_MODE (x); + if (optab_handler (mov_optab, mode) != CODE_FOR_nothing) + write_complex_part (x, read_complex_part (y, BOTH_P), BOTH_P, false); + else + { + write_complex_part (x, read_complex_part (y, REAL_P), REAL_P, true); + write_complex_part (x, read_complex_part (y, IMAG_P), IMAG_P, false); + } return get_last_insn (); } @@ -3868,14 +3874,14 @@ emit_move_complex (machine_mode mode, rtx x, rtx y) /* See if we can coerce the target into moving both values at once, except for floating point where we favor moving as parts if this is easy. */ - if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT + scalar_int_mode imode; + if (!int_mode_for_mode (mode).exists (&imode)) + try_int = false; + else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT && optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing - && !(REG_P (x) - && HARD_REGISTER_P (x) - && REG_NREGS (x) == 1) - && !(REG_P (y) - && HARD_REGISTER_P (y) - && REG_NREGS (y) == 1)) + && optab_handler (mov_optab, mode) != CODE_FOR_nothing + && !(REG_P (x) && HARD_REGISTER_P (x)) + && !(REG_P (y) && HARD_REGISTER_P (y))) try_int = false; /* Not possible if the values are inherently not adjacent. */ else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT) @@ -10246,9 +10252,14 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, break; } - /* Move the real (op0) and imaginary (op1) parts to their location. */ - write_complex_part (target, op0, REAL_P, true); - write_complex_part (target, op1, IMAG_P, false); + if ((op0 == op1) && (GET_CODE (op0) == CONST_VECTOR)) + write_complex_part (target, op0, BOTH_P, false); + else + { + /* Move the real (op0) and imaginary (op1) parts to their location. */ + write_complex_part (target, op0, REAL_P, true); + write_complex_part (target, op1, IMAG_P, false); + } return target; @@ -11001,6 +11012,51 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, return original_target; } + else if (original_target && (GET_CODE (original_target) == REG) + && + ((GET_MODE_CLASS (GET_MODE (original_target)) == + MODE_COMPLEX_INT) + || (GET_MODE_CLASS (GET_MODE (original_target)) == + MODE_COMPLEX_FLOAT))) + { + mode = TYPE_MODE (TREE_TYPE (exp)); + + /* Move both parts at the same time if possible */ + if (TREE_COMPLEX_BOTH_PARTS (exp) != NULL) + { + op0 = + expand_expr (TREE_COMPLEX_BOTH_PARTS (exp), original_target, + mode, EXPAND_NORMAL); + write_complex_part (original_target, op0, BOTH_P, false); + } + else + { + mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp))); + + rtx rtarg = gen_reg_rtx (mode); + rtx itarg = gen_reg_rtx (mode); + op0 = + expand_expr (TREE_REALPART (exp), rtarg, mode, EXPAND_NORMAL); + op1 = + expand_expr (TREE_IMAGPART (exp), itarg, mode, EXPAND_NORMAL); + + write_complex_part (original_target, op0, REAL_P, false); + write_complex_part (original_target, op1, IMAG_P, false); + + return original_target; + } + } + /* TODO use a finer grain approach than just size of 2 words */ + else if ((TREE_COMPLEX_BOTH_PARTS (exp) != NULL) + && (known_le (GET_MODE_BITSIZE (mode), 2 * BITS_PER_WORD))) + { + op0 = + expand_expr (TREE_COMPLEX_BOTH_PARTS (exp), original_target, mode, + EXPAND_NORMAL); + rtx tmp = gen_reg_rtx (mode); + write_complex_part (tmp, op0, BOTH_P, false); + return tmp; + } /* fall through */ @@ -13347,6 +13403,10 @@ const_vector_from_tree (tree exp) else if (TREE_CODE (elt) == FIXED_CST) builder.quick_push (CONST_FIXED_FROM_FIXED_VALUE (TREE_FIXED_CST (elt), inner)); + else if (TREE_CODE (elt) == COMPLEX_CST) + builder.quick_push (expand_expr + (TREE_COMPLEX_BOTH_PARTS (elt), NULL_RTX, mode, + EXPAND_NORMAL)); else builder.quick_push (immed_wide_int_const (wi::to_poly_wide (elt), inner)); diff --git a/gcc/machmode.h b/gcc/machmode.h index a22df60dc20..b1937eafdc3 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -119,6 +119,12 @@ extern const unsigned char mode_class[NUM_MACHINE_MODES]; || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT) +#define COMPLEX_INT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) + +#define COMPLEX_FLOAT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) + /* Nonzero if MODE is a complex mode. */ #define COMPLEX_MODE_P(MODE) \ (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \ diff --git a/gcc/optabs-libfuncs.cc b/gcc/optabs-libfuncs.cc index f1abe6916d3..fe390a592eb 100644 --- a/gcc/optabs-libfuncs.cc +++ b/gcc/optabs-libfuncs.cc @@ -190,19 +190,34 @@ gen_int_libfunc (optab optable, const char *opname, char suffix, int maxsize = 2 * BITS_PER_WORD; int minsize = BITS_PER_WORD; scalar_int_mode int_mode; + complex_mode cplx_int_mode; + int bitsize; + bool cplx = false; - if (!is_int_mode (mode, &int_mode)) + if (is_int_mode (mode, &int_mode)) + bitsize = GET_MODE_BITSIZE (int_mode); + else if (is_complex_int_mode (mode, &cplx_int_mode)) + { + cplx = true; + bitsize = GET_MODE_BITSIZE (cplx_int_mode); + } + else return; + if (maxsize < LONG_LONG_TYPE_SIZE) maxsize = LONG_LONG_TYPE_SIZE; if (minsize > INT_TYPE_SIZE && (trapv_binoptab_p (optable) || trapv_unoptab_p (optable))) minsize = INT_TYPE_SIZE; - if (GET_MODE_BITSIZE (int_mode) < minsize - || GET_MODE_BITSIZE (int_mode) > maxsize) + + if (bitsize < minsize || bitsize > maxsize) return; - gen_libfunc (optable, opname, suffix, int_mode); + + if (GET_MODE_CLASS (mode) == MODE_INT) + gen_libfunc (optable, opname, suffix, int_mode); + else if (cplx) + gen_libfunc (optable, opname, suffix, cplx_int_mode); } /* Like gen_libfunc, but verify that FP and set decimal prefix if needed. */ @@ -280,9 +295,11 @@ void gen_intv_fp_libfunc (optab optable, const char *name, char suffix, machine_mode mode) { - if (DECIMAL_FLOAT_MODE_P (mode) || GET_MODE_CLASS (mode) == MODE_FLOAT) + if (DECIMAL_FLOAT_MODE_P (mode) || GET_MODE_CLASS (mode) == MODE_FLOAT + || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT) gen_fp_libfunc (optable, name, suffix, mode); - if (GET_MODE_CLASS (mode) == MODE_INT) + if (GET_MODE_CLASS (mode) == MODE_INT + || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT) { int len = strlen (name); char *v_name = XALLOCAVEC (char, len + 2); diff --git a/gcc/real.h b/gcc/real.h index 9ed6c372b14..53585418e68 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -189,7 +189,8 @@ extern const struct real_format * : (gcc_unreachable (), 0)]) #define FLOAT_MODE_FORMAT(MODE) \ - (REAL_MODE_FORMAT (as_a (GET_MODE_INNER (MODE)))) + (REAL_MODE_FORMAT (as_a \ + (GET_MODE_INNER ((COMPLEX_FLOAT_MODE_P (MODE)) ? (GET_MODE_INNER (MODE)) : (MODE))))) /* The following macro determines whether the floating point format is composite, i.e. may contain non-consecutive mantissa bits, in which diff --git a/gcc/recog.cc b/gcc/recog.cc index 37432087812..687fe2b1b8a 100644 --- a/gcc/recog.cc +++ b/gcc/recog.cc @@ -1441,6 +1441,7 @@ general_operand (rtx op, machine_mode mode) if the caller wants something floating. */ if (GET_MODE (op) == VOIDmode && mode != VOIDmode && GET_MODE_CLASS (mode) != MODE_INT + && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT) return false; -- 2.17.1