Re: [PATCH][AArch64][obvious] Clean up parentheses and use GET_MODE_UNIT_BITSIZE in a couple of patterns

2016-06-15 Thread Kyrill Tkachov


On 15/06/16 17:12, Andreas Schwab wrote:

Kyrill Tkachov  writes:


diff --git a/gcc/config/aarch64/aarch64-simd.md 
b/gcc/config/aarch64/aarch64-simd.md
index 
6effd7d42d18c9b526aaaec93a44e8801908e164..a19d1711b5bcb516e4aca6a22d1b79df4f32923f
 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -3993,15 +3993,12 @@ (define_insn "aarch64_shll_n"
   "aarch64_simd_shift_imm_bitsize_" "i")]
   VSHLL))]
"TARGET_SIMD"
-  "*
-  int bit_width = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
-  if (INTVAL (operands[2]) == bit_width)
{
-return \"shll\\t%0., %1., %2\";
+if (INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (mode))
+  return "shll\\t%0., %1., %2";
+else
+  return "shll\\t%0., %1., %2";

You need to unquote the backslashes, too.


You mean not escape the '\t'?
The port uses \\t for tabs, even in {...} templates, though not consistently.
That could be cleaned up separately.

Kyrill


Andreas.





Re: [PATCH][AArch64][obvious] Clean up parentheses and use GET_MODE_UNIT_BITSIZE in a couple of patterns

2016-06-15 Thread Andreas Schwab
Kyrill Tkachov  writes:

> diff --git a/gcc/config/aarch64/aarch64-simd.md 
> b/gcc/config/aarch64/aarch64-simd.md
> index 
> 6effd7d42d18c9b526aaaec93a44e8801908e164..a19d1711b5bcb516e4aca6a22d1b79df4f32923f
>  100644
> --- a/gcc/config/aarch64/aarch64-simd.md
> +++ b/gcc/config/aarch64/aarch64-simd.md
> @@ -3993,15 +3993,12 @@ (define_insn "aarch64_shll_n"
>  "aarch64_simd_shift_imm_bitsize_" "i")]
>   VSHLL))]
>"TARGET_SIMD"
> -  "*
> -  int bit_width = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
> -  if (INTVAL (operands[2]) == bit_width)
>{
> -return \"shll\\t%0., %1., %2\";
> +if (INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (mode))
> +  return "shll\\t%0., %1., %2";
> +else
> +  return "shll\\t%0., %1., %2";

You need to unquote the backslashes, too.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


[PATCH][AArch64][obvious] Clean up parentheses and use GET_MODE_UNIT_BITSIZE in a couple of patterns

2016-06-15 Thread Kyrill Tkachov

Hi all,

The parentheses in these two patterns are a bit of a mess and we can remove 
them.
Do that. also, use '{' and '}' for the C code so that we can avoid escaping the 
strings
in the block.  Also, use GET_MODE_UNIT_BITSIZE directly instead of taking 
GET_MODE_UNIT_SIZE and
multiplying by BITS_PER_UNIT which is equivalent.

Bootstrapped and tested on aarch64.
Committing as obvious.

Thanks,
Kyrill

2016-06-15  Kyrylo Tkachov  

* config/aarch64/aarch64-simd.md (aarch64_shll_n): Clean
up parentheses.  Use GET_MODE_UNIT_BITSIZE.
(aarch64_shll2_n): Likewise.
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 6effd7d42d18c9b526aaaec93a44e8801908e164..a19d1711b5bcb516e4aca6a22d1b79df4f32923f 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -3993,15 +3993,12 @@ (define_insn "aarch64_shll_n"
 			   "aarch64_simd_shift_imm_bitsize_" "i")]
  VSHLL))]
   "TARGET_SIMD"
-  "*
-  int bit_width = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
-  if (INTVAL (operands[2]) == bit_width)
   {
-return \"shll\\t%0., %1., %2\";
+if (INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (mode))
+  return "shll\\t%0., %1., %2";
+else
+  return "shll\\t%0., %1., %2";
   }
-  else {
-return \"shll\\t%0., %1., %2\";
-  }"
   [(set_attr "type" "neon_shift_imm_long")]
 )
 
@@ -4013,15 +4010,12 @@ (define_insn "aarch64_shll2_n"
 			 (match_operand:SI 2 "immediate_operand" "i")]
  VSHLL))]
   "TARGET_SIMD"
-  "*
-  int bit_width = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
-  if (INTVAL (operands[2]) == bit_width)
   {
-return \"shll2\\t%0., %1., %2\";
+if (INTVAL (operands[2]) == GET_MODE_UNIT_BITSIZE (mode))
+  return "shll2\\t%0., %1., %2";
+else
+  return "shll2\\t%0., %1., %2";
   }
-  else {
-return \"shll2\\t%0., %1., %2\";
-  }"
   [(set_attr "type" "neon_shift_imm_long")]
 )