From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zg8tndyumtaxlji0oc4xnzya.icoremail.net (zg8tndyumtaxlji0oc4xnzya.icoremail.net [46.101.248.176]) by sourceware.org (Postfix) with ESMTP id 17B41385DC13 for ; Tue, 28 Nov 2023 02:33:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17B41385DC13 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17B41385DC13 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=46.101.248.176 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701138807; cv=none; b=m4wemdidQWZejNh5LRQYp+vg6HMzTWBdo2zFvXIKcPTB49AyLJ8tHSBhiFz5lvpDfqPobL4A2LNR/qlCuqS/jz5/9WxHST9C/d3MeTSODKsViXESCvYnKWzdrAUnO0lQcOXGeKkoXqimK9oSy1fc4NiWa4Sn0VfkVfNxSak5gSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701138807; c=relaxed/simple; bh=y3ASOncKEJTzacvEP3V6dQv+XnHta3GH+rPLRA5MJN4=; h=From:To:Subject:Date:Message-Id; b=nH9T/HC3ZT25GM7K7VZob7Ep0Er3a+9RkN4B/X+/27rH/Vv9yZ3q3TWxvOhhTTrAwXI5cRDbA/FdAYCgm0Uo6dON2JLty+a5zOT7m/pgBkrZQG9yjadIA5D1E/Jf6SgGZjohPOWDX/rxJJEzmjXNdIImFkPWoRrdcjFvNPOKaoo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (unknown [10.12.130.31]) by app1 (Coremail) with SMTP id TAJkCgA3H4E0UWVl1pkBAA--.18663S7; Tue, 28 Nov 2023 10:32:26 +0800 (CST) From: Fei Gao To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, zengxiao@eswincomputing.com, Fei Gao Subject: [PATCH 4/4] [V2] [ifcvt] prefer SFB to Zicond for x=c ? (y op CONST) : y. Date: Tue, 28 Nov 2023 02:32:27 +0000 Message-Id: <20231128023227.36200-4-gaofei@eswincomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231128023227.36200-1-gaofei@eswincomputing.com> References: <20231128023227.36200-1-gaofei@eswincomputing.com> X-CM-TRANSID:TAJkCgA3H4E0UWVl1pkBAA--.18663S7 X-Coremail-Antispam: 1UD129KBjvAXoW3tw1UuFWUZr4rZr47uw48Zwb_yoW8ZrWxCo WfZr98tF4vgr17Wr18Gr4YvF1jqF45Z34DKF4Yvr15XrWqyF4Sgw4rWa1Dta4rKFWS9ry7 AFsaqw1xK395Arsxn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UjIYCTnIWjp_UUUYC7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20EY4v20xva j40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r1rM28IrcIa0x kI8VCY1x0267AKxVW8JVW5JwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84AC jcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr 1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVCm-wCF04k20x vY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I 3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIx AIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAI cVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2js IEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU4q2_UUUUU= X-CM-SenderInfo: xjdrwv3l6h245lqf0zpsxwx03jof0z/ X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_SHORT,LIKELY_SPAM_BODY,RCVD_IN_MSPIKE_H2,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: In x=c ? (y op CONST) : y cases, Zicond based czero ifcvt generates more true dependency in code sequence than SFB based movcc. So exit noce_try_cond_zero_arith in such cases to have a better code sequence generated by noce_try_cmove_arith. Take the following case for example. CFLAGS: -mtune=sifive-7-series -march=rv64gc_zbb_zicond -mabi=lp64d -O2 unsigned int test_RotateR_eqz_imm_int (unsigned int x, unsigned int y, unsigned int c) { if (c) x = (y >> 11) | (y << (32 - 11)); else x = y; return x; } before patch: li a5,11 czero.eqz a2,a5,a2 rorw a0,a1,a2 ret after patch: roriw a0,a1,11 bne a2,zero,1f # movcc mv a0,a1 1: ret Co-authored-by: Xiao Zeng gcc/ChangeLog: * config/riscv/riscv.cc (riscv_have_sfb): hook implementation (TARGET_HAVE_SFB): define hook in riscv * doc/tm.texi: add TARGET_HAVE_SFB * doc/tm.texi.in: add TARGET_HAVE_SFB * ifcvt.cc (noce_try_cond_zero_arith): prefer SFB for x=c ? (y op CONST) : y * target.def:add TARGET_HAVE_SFB gcc/testsuite/ChangeLog: * gcc.target/riscv/zicond_sfb_ifcvt_opt.c: New test. --- gcc/config/riscv/riscv.cc | 12 + gcc/doc/tm.texi | 4 + gcc/doc/tm.texi.in | 2 + gcc/ifcvt.cc | 4 +- gcc/target.def | 7 + .../gcc.target/riscv/zicond_sfb_ifcvt_opt.c | 1354 +++++++++++++++++ 6 files changed, 1382 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/riscv/zicond_sfb_ifcvt_opt.c diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index d0efb939bf2..91fb4ebd653 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -10191,6 +10191,14 @@ riscv_vectorize_related_mode (machine_mode vector_mode, scalar_mode element_mode return default_vectorize_related_mode (vector_mode, element_mode, nunits); } +/* Implement TARGET_HAVE_SFB. */ + +bool +riscv_have_sfb (void) +{ + return TARGET_SFB_ALU; +} + /* Implement TARGET_VECTORIZE_VEC_PERM_CONST. */ static bool @@ -10536,6 +10544,10 @@ extract_base_offset_in_addr (rtx mem, rtx *base, rtx *offset) #define TARGET_DEFAULT_TARGET_FLAGS (MASK_BIG_ENDIAN) #endif +#undef TARGET_HAVE_SFB +#define TARGET_HAVE_SFB \ + riscv_have_sfb + #undef TARGET_VECTOR_MODE_SUPPORTED_P #define TARGET_VECTOR_MODE_SUPPORTED_P riscv_vector_mode_supported_p diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 645559ea084..9b4e3f71569 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12149,6 +12149,10 @@ This target hook is required only when the target has several different modes and they have different conditional execution capability, such as ARM. @end deftypefn +@deftypefn {Target Hook} bool TARGET_HAVE_SFB (void) +This target hook returns true if the target supports Short Forward Branch. +@end deftypefn + @deftypefn {Target Hook} rtx TARGET_GEN_CCMP_FIRST (rtx_insn **@var{prep_seq}, rtx_insn **@var{gen_seq}, rtx_code @var{code}, tree @var{op0}, tree @var{op1}) This function prepares to emit a comparison insn for the first compare in a sequence of conditional comparisions. It returns an appropriate comparison diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 4ddc8507ed9..6dac432605f 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7843,6 +7843,8 @@ lists. @hook TARGET_HAVE_CONDITIONAL_EXECUTION +@hook TARGET_HAVE_SFB + @hook TARGET_GEN_CCMP_FIRST @hook TARGET_GEN_CCMP_NEXT diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index 4cc6a125ff0..c0f42a7ab1f 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3068,10 +3068,12 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info) &a, &to_replace)) return false; - start_sequence (); + if (targetm.have_sfb () && CONST_INT_P (*to_replace)) + return false; bin_code = GET_CODE (bin_exp); bin_op0 = XEXP (bin_exp, 0); + start_sequence (); if (CONST_INT_P (*to_replace)) { diff --git a/gcc/target.def b/gcc/target.def index 475c55c22c1..6d9b71e165b 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2726,6 +2726,13 @@ modes and they have different conditional execution capability, such as ARM.", bool, (void), default_have_conditional_execution) +/* Return true if the target supports SFB. */ +DEFHOOK +(have_sfb, + "This target hook returns true if the target supports Short Forward Branch.", + bool, (void), + hook_bool_void_false) + DEFHOOK (gen_ccmp_first, "This function prepares to emit a comparison insn for the first compare in a\n\ diff --git a/gcc/testsuite/gcc.target/riscv/zicond_sfb_ifcvt_opt.c b/gcc/testsuite/gcc.target/riscv/zicond_sfb_ifcvt_opt.c new file mode 100644 index 00000000000..a9cad788956 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zicond_sfb_ifcvt_opt.c @@ -0,0 +1,1354 @@ +/* { dg-do compile } */ +/* { dg-options "-mtune=sifive-7-series -march=rv64gc_zbb_zicond -mabi=lp64d -O2 " } */ +/* { dg-skip-if "" { *-*-* } {"-O0" "-O1" "-Os" "-Og" "-O3" "-Oz" "-flto"} } */ + +long +test_ADD_ceqz (long x, long y, long z, long c) +{ + if (c) + x = y + z; + else + x = y; + return x; +} + +long +test_ADD_ceqz_x (long x, long z, long c) +{ + if (c) + x = x + z; + + return x; +} + +long +test_ADD_nez (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = y + z; + return x; +} + +long +test_ADD_nez_x (long x, long z, long c) +{ + if (c) + { + } + else + x = x + z; + return x; +} + +long +test_ADD_nez_2 (long x, long y, long z, long c) +{ + if (!c) + x = y + z; + else + x = y; + return x; +} + +long +test_ADD_nez_x_2 (long x, long z, long c) +{ + if (!c) + x = x + z; + + return x; +} + +long +test_ADD_eqz_2 (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = y + z; + return x; +} + +long +test_ADD_eqz_x_2 (long x, long z, long c) +{ + if (!c) + { + } + else + x = x + z; + return x; +} + +long +test_SUB_ceqz (long x, long y, long z, long c) +{ + if (c) + x = y - z; + else + x = y; + return x; +} + +long +test_SUB_ceqz_x (long x, long z, long c) +{ + if (c) + x = x - z; + + return x; +} + +long +test_SUB_nez (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = y - z; + return x; +} + +long +test_SUB_nez_x (long x, long z, long c) +{ + if (c) + { + } + else + x = x - z; + return x; +} + +long +test_SUB_nez_2 (long x, long y, long z, long c) +{ + if (!c) + x = y - z; + else + x = y; + return x; +} + +long +test_SUB_nez_x_2 (long x, long z, long c) +{ + if (!c) + x = x - z; + + return x; +} + +long +test_SUB_eqz_2 (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = y - z; + return x; +} + +long +test_SUB_eqz_x_2 (long x, long z, long c) +{ + if (!c) + { + } + else + x = x - z; + return x; +} + +long +test_IOR_ceqz (long x, long y, long z, long c) +{ + if (c) + x = y | z; + else + x = y; + return x; +} + +long +test_IOR_ceqz_x (long x, long z, long c) +{ + if (c) + x = x | z; + + return x; +} + +long +test_IOR_nez (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = y | z; + return x; +} + +long +test_IOR_nez_x (long x, long z, long c) +{ + if (c) + { + } + else + x = x | z; + return x; +} + +long +test_IOR_nez_2 (long x, long y, long z, long c) +{ + if (!c) + x = y | z; + else + x = y; + return x; +} + +long +test_IOR_nez_x_2 (long x, long z, long c) +{ + if (!c) + x = x | z; + + return x; +} + +long +test_IOR_eqz_2 (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = y | z; + return x; +} + +long +test_IOR_eqz_x_2 (long x, long z, long c) +{ + if (!c) + { + } + else + x = x | z; + return x; +} + +long +test_XOR_ceqz (long x, long y, long z, long c) +{ + if (c) + x = y ^ z; + else + x = y; + return x; +} + +long +test_XOR_ceqz_x (long x, long z, long c) +{ + if (c) + x = x ^ z; + + return x; +} + +long +test_XOR_nez (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = y ^ z; + return x; +} + +long +test_XOR_nez_x (long x, long z, long c) +{ + if (c) + { + } + else + x = x ^ z; + return x; +} + +long +test_XOR_nez_2 (long x, long y, long z, long c) +{ + if (!c) + x = y ^ z; + else + x = y; + return x; +} + +long +test_XOR_nez_x_2 (long x, long z, long c) +{ + if (!c) + x = x ^ z; + + return x; +} + +long +test_XOR_eqz_2 (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = y ^ z; + return x; +} + +long +test_XOR_eqz_x_2 (long x, long z, long c) +{ + if (!c) + { + } + else + x = x ^ z; + return x; +} + +long +test_ADD_ceqz_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = z + y; + else + x = y; + return x; +} + +long +test_ADD_ceqz_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + x = z + x; + + return x; +} + +long +test_ADD_nez_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = z + y; + return x; +} + +long +test_ADD_nez_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + { + } + else + x = z + x; + return x; +} + +long +test_ADD_nez_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = z + y; + else + x = y; + return x; +} + +long +test_ADD_nez_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + x = z + x; + + return x; +} + +long +test_ADD_eqz_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = z + y; + return x; +} + +long +test_ADD_eqz_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + { + } + else + x = z + x; + return x; +} + +long +test_IOR_ceqz_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = z | y; + else + x = y; + return x; +} + +long +test_IOR_ceqz_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + x = z | x; + + return x; +} + +long +test_IOR_nez_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = z | y; + return x; +} + +long +test_IOR_nez_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + { + } + else + x = z | x; + return x; +} + +long +test_IOR_nez_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = z | y; + else + x = y; + return x; +} + +long +test_IOR_nez_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + x = z | x; + + return x; +} + +long +test_IOR_eqz_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = z | y; + return x; +} + +long +test_IOR_eqz_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + { + } + else + x = z | x; + return x; +} + +long +test_XOR_ceqz_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = z ^ y; + else + x = y; + return x; +} + +long +test_XOR_ceqz_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + x = z ^ x; + + return x; +} + +long +test_XOR_nez_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (c) + x = y; + else + x = z ^ y; + return x; +} + +long +test_XOR_nez_x_reverse_bin_oprands (long x, long z, long c) +{ + if (c) + { + } + else + x = z ^ x; + return x; +} + +long +test_XOR_nez_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = z ^ y; + else + x = y; + return x; +} + +long +test_XOR_nez_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + x = z ^ x; + + return x; +} + +long +test_XOR_eqz_2_reverse_bin_oprands (long x, long y, long z, long c) +{ + if (!c) + x = y; + else + x = z ^ y; + return x; +} + +long +test_XOR_eqz_x_2_reverse_bin_oprands (long x, long z, long c) +{ + if (!c) + { + } + else + x = z ^ x; + return x; +} + +long +test_ShiftLeft_eqz (long x, long y, long z, long c) +{ + if (c) + x = y << z; + else + x = y; + return x; +} + +long +test_ShiftR_eqz (long x, long y, long z, long c) +{ + if (c) + x = y >> z; + else + x = y; + return x; +} + +unsigned long +test_ShiftR_logical_eqz (unsigned long x, unsigned long y, unsigned long z, + unsigned long c) +{ + if (c) + x = y >> z; + else + x = y; + return x; +} + +unsigned long +test_RotateL_eqz (unsigned long x, unsigned long y, unsigned long z, + unsigned long c) +{ + if (c) + x = (y << z) | (y >> (64 - z)); + else + x = y; + return x; +} + +unsigned long +test_RotateR_eqz (unsigned long x, unsigned long y, unsigned long z, + unsigned long c) +{ + if (c) + x = (y >> z) | (y << (64 - z)); + else + x = y; + return x; +} + +int +test_ADD_ceqz_int (int x, int y, int z, int c) +{ + if (c) + x = y + z; + else + x = y; + return x; +} + +int +test_ShiftLeft_eqz_int (int x, int y, int z, int c) +{ + if (c) + x = y << z; + else + x = y; + return x; +} + +int +test_ShiftR_eqz_int (int x, int y, int z, int c) +{ + if (c) + x = y >> z; + else + x = y; + return x; +} + +unsigned int +test_ShiftR_logical_eqz_int (unsigned int x, unsigned int y, unsigned int z, + unsigned int c) +{ + if (c) + x = y >> z; + else + x = y; + return x; +} + +unsigned int +test_RotateL_eqz_int (unsigned int x, unsigned int y, unsigned int z, + unsigned int c) +{ + if (c) + x = (y << z) | (y >> (32 - z)); + else + x = y; + return x; +} + +unsigned int +test_RotateR_eqz_int (unsigned int x, unsigned int y, unsigned int z, + unsigned int c) +{ + if (c) + x = (y >> z) | (y << (32 - z)); + else + x = y; + return x; +} + +long +test_ADD_ceqz_imm (long x, long y, long c) +{ + if (c) + x = y + 11; + else + x = y; + return x; +} + +long +test_ADD_ceqz_x_imm (long x, long c) +{ + if (c) + x = x + 11; + + return x; +} + +long +test_ADD_nez_imm (long x, long y, long c) +{ + if (c) + x = y; + else + x = y + 11; + return x; +} + +long +test_ADD_nez_x_imm (long x, long c) +{ + if (c) + { + } + else + x = x + 11; + return x; +} + +long +test_ADD_nez_2_imm (long x, long y, long c) +{ + if (!c) + x = y + 11; + else + x = y; + return x; +} + +long +test_ADD_nez_x_2_imm (long x, long c) +{ + if (!c) + x = x + 11; + + return x; +} + +long +test_ADD_eqz_2_imm (long x, long y, long c) +{ + if (!c) + x = y; + else + x = y + 11; + return x; +} + +long +test_ADD_eqz_x_2_imm (long x, long c) +{ + if (!c) + { + } + else + x = x + 11; + return x; +} + +long +test_SUB_ceqz_imm (long x, long y, long c) +{ + if (c) + x = y - 11; + else + x = y; + return x; +} + +long +test_SUB_ceqz_x_imm (long x, long c) +{ + if (c) + x = x - 11; + + return x; +} + +long +test_SUB_nez_imm (long x, long y, long c) +{ + if (c) + x = y; + else + x = y - 11; + return x; +} + +long +test_SUB_nez_x_imm (long x, long c) +{ + if (c) + { + } + else + x = x - 11; + return x; +} + +long +test_SUB_nez_2_imm (long x, long y, long c) +{ + if (!c) + x = y - 11; + else + x = y; + return x; +} + +long +test_SUB_nez_x_2_imm (long x, long c) +{ + if (!c) + x = x - 11; + + return x; +} + +long +test_SUB_eqz_2_imm (long x, long y, long c) +{ + if (!c) + x = y; + else + x = y - 11; + return x; +} + +long +test_SUB_eqz_x_2_imm (long x, long c) +{ + if (!c) + { + } + else + x = x - 11; + return x; +} + +long +test_IOR_ceqz_imm (long x, long y, long c) +{ + if (c) + x = y | 11; + else + x = y; + return x; +} + +long +test_IOR_ceqz_x_imm (long x, long c) +{ + if (c) + x = x | 11; + + return x; +} + +long +test_IOR_nez_imm (long x, long y, long c) +{ + if (c) + x = y; + else + x = y | 11; + return x; +} + +long +test_IOR_nez_x_imm (long x, long c) +{ + if (c) + { + } + else + x = x | 11; + return x; +} + +long +test_IOR_nez_2_imm (long x, long y, long c) +{ + if (!c) + x = y | 11; + else + x = y; + return x; +} + +long +test_IOR_nez_x_2_imm (long x, long c) +{ + if (!c) + x = x | 11; + + return x; +} + +long +test_IOR_eqz_2_imm (long x, long y, long c) +{ + if (!c) + x = y; + else + x = y | 11; + return x; +} + +long +test_IOR_eqz_x_2_imm (long x, long c) +{ + if (!c) + { + } + else + x = x | 11; + return x; +} + +long +test_XOR_ceqz_imm (long x, long y, long c) +{ + if (c) + x = y ^ 11; + else + x = y; + return x; +} + +long +test_XOR_ceqz_x_imm (long x, long c) +{ + if (c) + x = x ^ 11; + + return x; +} + +long +test_XOR_nez_imm (long x, long y, long c) +{ + if (c) + x = y; + else + x = y ^ 11; + return x; +} + +long +test_XOR_nez_x_imm (long x, long c) +{ + if (c) + { + } + else + x = x ^ 11; + return x; +} + +long +test_XOR_nez_2_imm (long x, long y, long c) +{ + if (!c) + x = y ^ 11; + else + x = y; + return x; +} + +long +test_XOR_nez_x_2_imm (long x, long c) +{ + if (!c) + x = x ^ 11; + + return x; +} + +long +test_XOR_eqz_2_imm (long x, long y, long c) +{ + if (!c) + x = y; + else + x = y ^ 11; + return x; +} + +long +test_XOR_eqz_x_2_imm (long x, long c) +{ + if (!c) + { + } + else + x = x ^ 11; + return x; +} + +long +test_ADD_ceqz_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = 11 + y; + else + x = y; + return x; +} + +long +test_ADD_ceqz_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + x = 11 + x; + + return x; +} + +long +test_ADD_nez_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = y; + else + x = 11 + y; + return x; +} + +long +test_ADD_nez_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + { + } + else + x = 11 + x; + return x; +} + +long +test_ADD_nez_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = 11 + y; + else + x = y; + return x; +} + +long +test_ADD_nez_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + x = 11 + x; + + return x; +} + +long +test_ADD_eqz_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = y; + else + x = 11 + y; + return x; +} + +long +test_ADD_eqz_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + { + } + else + x = 11 + x; + return x; +} + +long +test_IOR_ceqz_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = 11 | y; + else + x = y; + return x; +} + +long +test_IOR_ceqz_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + x = 11 | x; + + return x; +} + +long +test_IOR_nez_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = y; + else + x = 11 | y; + return x; +} + +long +test_IOR_nez_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + { + } + else + x = 11 | x; + return x; +} + +long +test_IOR_nez_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = 11 | y; + else + x = y; + return x; +} + +long +test_IOR_nez_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + x = 11 | x; + + return x; +} + +long +test_IOR_eqz_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = y; + else + x = 11 | y; + return x; +} + +long +test_IOR_eqz_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + { + } + else + x = 11 | x; + return x; +} + +long +test_XOR_ceqz_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = 11 ^ y; + else + x = y; + return x; +} + +long +test_XOR_ceqz_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + x = 11 ^ x; + + return x; +} + +long +test_XOR_nez_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (c) + x = y; + else + x = 11 ^ y; + return x; +} + +long +test_XOR_nez_x_imm_reverse_bin_oprands (long x, long c) +{ + if (c) + { + } + else + x = 11 ^ x; + return x; +} + +long +test_XOR_nez_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = 11 ^ y; + else + x = y; + return x; +} + +long +test_XOR_nez_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + x = 11 ^ x; + + return x; +} + +long +test_XOR_eqz_2_imm_reverse_bin_oprands (long x, long y, long c) +{ + if (!c) + x = y; + else + x = 11 ^ y; + return x; +} + +long +test_XOR_eqz_x_2_imm_reverse_bin_oprands (long x, long c) +{ + if (!c) + { + } + else + x = 11 ^ x; + return x; +} + +long +test_ShiftLeft_eqz_imm (long x, long y, long c) +{ + if (c) + x = y << 11; + else + x = y; + return x; +} + +long +test_ShiftR_eqz_imm (long x, long y, long c) +{ + if (c) + x = y >> 11; + else + x = y; + return x; +} + +unsigned long +test_ShiftR_logical_eqz_imm (unsigned long x, unsigned long y, unsigned long z, + unsigned long c) +{ + if (c) + x = y >> 11; + else + x = y; + return x; +} + +unsigned long +test_RotateL_eqz_imm (unsigned long x, unsigned long y, unsigned long c) +{ + if (c) + x = (y << 11) | (y >> (64 - 11)); + else + x = y; + return x; +} + +unsigned long +test_RotateR_eqz_imm (unsigned long x, unsigned long y, unsigned long c) +{ + if (c) + x = (y >> 11) | (y << (64 - 11)); + else + x = y; + return x; +} + +int +test_ADD_ceqz_imm_int (int x, int y, int c) +{ + if (c) + x = y + 11; + else + x = y; + return x; +} + +int +test_ShiftLeft_eqz_imm_int (int x, int y, int c) +{ + if (c) + x = y << 11; + else + x = y; + return x; +} + +int +test_ShiftR_eqz_imm_int (int x, int y, int c) +{ + if (c) + x = y >> 11; + else + x = y; + return x; +} + +unsigned int +test_ShiftR_logical_eqz_imm_int (unsigned int x, unsigned int y, unsigned int c) +{ + if (c) + x = y >> 11; + else + x = y; + return x; +} + +unsigned int +test_RotateL_eqz_imm_int (unsigned int x, unsigned int y, unsigned int c) +{ + if (c) + x = (y << 11) | (y >> (32 - 11)); + else + x = y; + return x; +} + +unsigned int +test_RotateR_eqz_imm_int (unsigned int x, unsigned int y, unsigned int c) +{ + if (c) + x = (y >> 11) | (y << (32 - 11)); + else + x = y; + return x; +} + +/* { dg-final { scan-assembler-times {czero\.eqz} 39 } } */ +/* { dg-final { scan-assembler-times {czero\.nez} 28 } } */ +/* { dg-final { scan-assembler-times {movcc} 67 } } */ -- 2.17.1