Commit 0f525c3e by Walter Lee Committed by Walter Lee

TILE-Gx...

TILE-Gx: fixes the zero_extract/sign_extract patterns so that they
properly handle the case when pos + size > number of bits in a word.

	* config/tilegx/tilegx.md (*zero_extract): Use
	  define_insn_and_split instead of define_insn; Handle pos +
	  size > 64.
	  (*sign_extract): Likewise.

From-SVN: r242734
parent 3135d8fe
2016-11-22 Walter Lee <walt@tilera.com>
* config/tilegx/tilegx.md (*zero_extract): Use
define_insn_and_split instead of define_insn; Handle pos + size >
64.
(*sign_extract): Likewise.
2016-11-22 Marek Polacek <polacek@redhat.com> 2016-11-22 Marek Polacek <polacek@redhat.com>
PR tree-optimization/78455 PR tree-optimization/78455
...@@ -1237,7 +1237,7 @@ ...@@ -1237,7 +1237,7 @@
"ld<four_s_if_si>_tls\t%0, %1, tls_ie_load(%2)" "ld<four_s_if_si>_tls\t%0, %1, tls_ie_load(%2)"
[(set_attr "type" "X1_2cycle")]) [(set_attr "type" "X1_2cycle")])
(define_insn "*zero_extract<mode>" (define_insn_and_split "*zero_extract<mode>"
[(set (match_operand:I48MODE 0 "register_operand" "=r") [(set (match_operand:I48MODE 0 "register_operand" "=r")
(zero_extract:I48MODE (zero_extract:I48MODE
(match_operand:I48MODE 1 "reg_or_0_operand" "r") (match_operand:I48MODE 1 "reg_or_0_operand" "r")
...@@ -1245,6 +1245,18 @@ ...@@ -1245,6 +1245,18 @@
(match_operand:I48MODE 3 "u6bit_cint_operand" "n")))] (match_operand:I48MODE 3 "u6bit_cint_operand" "n")))]
"" ""
"bfextu\t%0, %r1, %3, %3+%2-1" "bfextu\t%0, %r1, %3, %3+%2-1"
"&& reload_completed"
[(set (match_dup 0) (zero_extract:I48MODE
(match_dup 1)
(match_dup 2)
(match_dup 3)))]
{
HOST_WIDE_INT bit_width = INTVAL (operands[2]);
HOST_WIDE_INT bit_offset = INTVAL (operands[3]);
if (bit_offset + bit_width > 64)
operands[2] = GEN_INT (64 - bit_offset);
}
[(set_attr "type" "X0")]) [(set_attr "type" "X0")])
(define_insn "*sign_extract_low32" (define_insn "*sign_extract_low32"
...@@ -1256,7 +1268,7 @@ ...@@ -1256,7 +1268,7 @@
"INTVAL (operands[3]) == 0 && INTVAL (operands[2]) == 32" "INTVAL (operands[3]) == 0 && INTVAL (operands[2]) == 32"
"addxi\t%0, %r1, 0") "addxi\t%0, %r1, 0")
(define_insn "*sign_extract" (define_insn_and_split "*sign_extract"
[(set (match_operand:I48MODE 0 "register_operand" "=r") [(set (match_operand:I48MODE 0 "register_operand" "=r")
(sign_extract:I48MODE (sign_extract:I48MODE
(match_operand:I48MODE 1 "reg_or_0_operand" "r") (match_operand:I48MODE 1 "reg_or_0_operand" "r")
...@@ -1264,6 +1276,18 @@ ...@@ -1264,6 +1276,18 @@
(match_operand:I48MODE 3 "u6bit_cint_operand" "n")))] (match_operand:I48MODE 3 "u6bit_cint_operand" "n")))]
"" ""
"bfexts\t%0, %r1, %3, %3+%2-1" "bfexts\t%0, %r1, %3, %3+%2-1"
"&& reload_completed"
[(set (match_dup 0) (sign_extract:I48MODE
(match_dup 1)
(match_dup 2)
(match_dup 3)))]
{
HOST_WIDE_INT bit_width = INTVAL (operands[2]);
HOST_WIDE_INT bit_offset = INTVAL (operands[3]);
if (bit_offset + bit_width > 64)
operands[2] = GEN_INT (64 - bit_offset);
}
[(set_attr "type" "X0")]) [(set_attr "type" "X0")])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment