Re: [PATCH 5/6] [ARC] Update fma expansions.

2018-06-13 Thread Claudiu Zissulescu
Done. Thank you,
Claudiu

On Tue, Jun 12, 2018 at 10:32 PM, Andrew Burgess
 wrote:
> * Claudiu Zissulescu  [2018-05-21 13:18:38 +0300]:
>
>> Make sure only one operand has an immediate.
>>
>> OK to apply?
>
> Looks good.
>
> Thanks,
> Andrew
>
>> Claudiu
>>
>> gcc/
>> 2018-03-21  Claudiu Zissulescu  
>>
>>   * config/arc/fpu.md (fmasf4): Force operand to register.
>>   (fnmasf4): Likewise.
>>
>> gcc/testsuite
>> 2018-03-21  Claudiu Zissulescu  
>>
>>   * gcc.target/arc/fma-1.c: New test.
>> ---
>>  gcc/config/arc/fpu.md|  6 ++
>>  gcc/testsuite/gcc.target/arc/fma-1.c | 13 +
>>  2 files changed, 19 insertions(+)
>>  create mode 100644 gcc/testsuite/gcc.target/arc/fma-1.c
>>
>> diff --git a/gcc/config/arc/fpu.md b/gcc/config/arc/fpu.md
>> index de876cac0c1..9457922667e 100644
>> --- a/gcc/config/arc/fpu.md
>> +++ b/gcc/config/arc/fpu.md
>> @@ -64,6 +64,9 @@
>> tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
>> emit_move_insn (tmp, operands[3]);
>> operands[3] = tmp;
>> +   if (!register_operand (operands[1], SFmode)
>> +&& !register_operand (operands[2], SFmode))
>> + operands[2] = force_reg (SFmode, operands[2]);
>> }")
>>
>>  (define_expand "fnmasf4"
>> @@ -77,6 +80,9 @@
>> tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
>> emit_move_insn (tmp, operands[3]);
>> operands[3] = tmp;
>> +   if (!register_operand (operands[1], SFmode)
>> +&& !register_operand (operands[2], SFmode))
>> + operands[2] = force_reg (SFmode, operands[2]);
>>  }")
>>
>>  (define_insn "fmasf4_fpu"
>> diff --git a/gcc/testsuite/gcc.target/arc/fma-1.c 
>> b/gcc/testsuite/gcc.target/arc/fma-1.c
>> new file mode 100644
>> index 000..c195ad98127
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/arc/fma-1.c
>> @@ -0,0 +1,13 @@
>> +/* { dg-do compile } */
>> +/* { dg-skip-if "FPU not available" { arc700 || arc6xx } } */
>> +/* { dg-options "-s -std=gnu11  -O2 -frounding-math -mfpu=fpus_all" } */
>> +
>> +const float a, b = 7.8539818525e01;
>> +
>> +/* Check if the fma operation is generated correctly.  */
>> +
>> +int foo (void)
>> +{
>> +  return (float)3.0 * b + a;
>> +}
>> +/* { dg-final { scan-assembler "fsmadd" } } */
>> --
>> 2.14.3
>>


Re: [PATCH 5/6] [ARC] Update fma expansions.

2018-06-12 Thread Andrew Burgess
* Claudiu Zissulescu  [2018-05-21 13:18:38 +0300]:

> Make sure only one operand has an immediate.
> 
> OK to apply?

Looks good.

Thanks,
Andrew

> Claudiu
> 
> gcc/
> 2018-03-21  Claudiu Zissulescu  
> 
>   * config/arc/fpu.md (fmasf4): Force operand to register.
>   (fnmasf4): Likewise.
> 
> gcc/testsuite
> 2018-03-21  Claudiu Zissulescu  
> 
>   * gcc.target/arc/fma-1.c: New test.
> ---
>  gcc/config/arc/fpu.md|  6 ++
>  gcc/testsuite/gcc.target/arc/fma-1.c | 13 +
>  2 files changed, 19 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.target/arc/fma-1.c
> 
> diff --git a/gcc/config/arc/fpu.md b/gcc/config/arc/fpu.md
> index de876cac0c1..9457922667e 100644
> --- a/gcc/config/arc/fpu.md
> +++ b/gcc/config/arc/fpu.md
> @@ -64,6 +64,9 @@
> tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
> emit_move_insn (tmp, operands[3]);
> operands[3] = tmp;
> +   if (!register_operand (operands[1], SFmode)
> +&& !register_operand (operands[2], SFmode))
> + operands[2] = force_reg (SFmode, operands[2]);
> }")
>  
>  (define_expand "fnmasf4"
> @@ -77,6 +80,9 @@
> tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
> emit_move_insn (tmp, operands[3]);
> operands[3] = tmp;
> +   if (!register_operand (operands[1], SFmode)
> +&& !register_operand (operands[2], SFmode))
> + operands[2] = force_reg (SFmode, operands[2]);
>  }")
>  
>  (define_insn "fmasf4_fpu"
> diff --git a/gcc/testsuite/gcc.target/arc/fma-1.c 
> b/gcc/testsuite/gcc.target/arc/fma-1.c
> new file mode 100644
> index 000..c195ad98127
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arc/fma-1.c
> @@ -0,0 +1,13 @@
> +/* { dg-do compile } */
> +/* { dg-skip-if "FPU not available" { arc700 || arc6xx } } */
> +/* { dg-options "-s -std=gnu11  -O2 -frounding-math -mfpu=fpus_all" } */
> +
> +const float a, b = 7.8539818525e01;
> +
> +/* Check if the fma operation is generated correctly.  */
> +
> +int foo (void)
> +{
> +  return (float)3.0 * b + a;
> +}
> +/* { dg-final { scan-assembler "fsmadd" } } */
> -- 
> 2.14.3
> 


[PATCH 5/6] [ARC] Update fma expansions.

2018-05-21 Thread Claudiu Zissulescu
Make sure only one operand has an immediate.

OK to apply?
Claudiu

gcc/
2018-03-21  Claudiu Zissulescu  

* config/arc/fpu.md (fmasf4): Force operand to register.
(fnmasf4): Likewise.

gcc/testsuite
2018-03-21  Claudiu Zissulescu  

* gcc.target/arc/fma-1.c: New test.
---
 gcc/config/arc/fpu.md|  6 ++
 gcc/testsuite/gcc.target/arc/fma-1.c | 13 +
 2 files changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/arc/fma-1.c

diff --git a/gcc/config/arc/fpu.md b/gcc/config/arc/fpu.md
index de876cac0c1..9457922667e 100644
--- a/gcc/config/arc/fpu.md
+++ b/gcc/config/arc/fpu.md
@@ -64,6 +64,9 @@
tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
emit_move_insn (tmp, operands[3]);
operands[3] = tmp;
+   if (!register_operand (operands[1], SFmode)
+&& !register_operand (operands[2], SFmode))
+ operands[2] = force_reg (SFmode, operands[2]);
}")
 
 (define_expand "fnmasf4"
@@ -77,6 +80,9 @@
tmp = gen_rtx_REG (SFmode, ACCL_REGNO);
emit_move_insn (tmp, operands[3]);
operands[3] = tmp;
+   if (!register_operand (operands[1], SFmode)
+&& !register_operand (operands[2], SFmode))
+ operands[2] = force_reg (SFmode, operands[2]);
 }")
 
 (define_insn "fmasf4_fpu"
diff --git a/gcc/testsuite/gcc.target/arc/fma-1.c 
b/gcc/testsuite/gcc.target/arc/fma-1.c
new file mode 100644
index 000..c195ad98127
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/fma-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-skip-if "FPU not available" { arc700 || arc6xx } } */
+/* { dg-options "-s -std=gnu11  -O2 -frounding-math -mfpu=fpus_all" } */
+
+const float a, b = 7.8539818525e01;
+
+/* Check if the fma operation is generated correctly.  */
+
+int foo (void)
+{
+  return (float)3.0 * b + a;
+}
+/* { dg-final { scan-assembler "fsmadd" } } */
-- 
2.14.3