From 41c3713a005950571de21c5755ae060e8b62c1aa Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 9 Sep 2015 14:07:01 +0000 Subject: [PATCH] nvptx.md (atomic_compare_and_swap): Use sel_truesi, not andsi. * config/nvptx/nvptx.md (atomic_compare_and_swap): Use sel_truesi, not andsi. From-SVN: r227587 --- gcc/ChangeLog | 5 +++++ gcc/config/nvptx/nvptx.md | 14 ++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 618bbe63abc..ed788ff4d34 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-09-09 Nathan Sidwell + + * config/nvptx/nvptx.md (atomic_compare_and_swap): Use + sel_truesi, not andsi. + 2015-09-09 Kyrylo Tkachov * config/arm/arm.md (*subsi3_compare0): Rename to... diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index b857e53bb22..f2ec3e4b0bf 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -1351,14 +1351,12 @@ (match_operand:SI 7 "const_int_operand")] ;; failure model "" { - emit_insn (gen_atomic_compare_and_swap_1 (operands[1], operands[2], operands[3], - operands[4], operands[6])); - - rtx tmp = gen_reg_rtx (GET_MODE (operands[0])); - emit_insn (gen_cstore4 (tmp, - gen_rtx_EQ (SImode, operands[1], operands[3]), - operands[1], operands[3])); - emit_insn (gen_andsi3 (operands[0], tmp, GEN_INT (1))); + emit_insn (gen_atomic_compare_and_swap_1 + (operands[1], operands[2], operands[3], operands[4], operands[6])); + + rtx cond = gen_reg_rtx (BImode); + emit_move_insn (cond, gen_rtx_EQ (BImode, operands[1], operands[3])); + emit_insn (gen_sel_truesi (operands[0], cond, GEN_INT (1), GEN_INT (0))); DONE; }) -- 2.30.2