[PATCH] [RS6000] Change maddld match_operand from DI to GPR

Li Jia He helijia@linux.ibm.com
Wed Jun 26 05:07:00 GMT 2019



On 2019/6/24 3:38 PM, Segher Boessenkool wrote:
> Hi Lijia,
> 
> On Mon, Jun 24, 2019 at 01:00:05AM -0500, Li Jia He wrote:
>> >From PowerPC ISA3.0, the description of `maddld RT, RA.RB, RC` is as follows:
>> 64-bit RA and RB are multiplied and then the RC is signed extend to 128 bits,
>> and add them together.
>>
>> We only apply it to 64-bit mode (DI) when implementing maddld.  However, if we
>> can guarantee that the result of the maddld operation will be limited to 32-bit
>> mode (SI), we can still apply it to 32-bit mode (SI).
> 
> Great :-)  Just some testcase comments:
> 
>> diff --git a/gcc/testsuite/gcc.target/powerpc/maddld-1.c b/gcc/testsuite/gcc.target/powerpc/maddld-1.c
>> new file mode 100644
>> index 00000000000..06f5f5774d4
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/powerpc/maddld-1.c
>> @@ -0,0 +1,19 @@
>> +/* { dg-do compile { target { powerpc*-*-* } } } */
> 
> powerpc* is the default in gcc.target/powerpc, so you can leave it out:
> 
> /* { dg-do compile } */
> 
> (and that is default itself, but it is good documentation for the target
> tests, many of those are run tests).
> 
>> +/* { dg-require-effective-target powerpc_p9modulo_ok } */
> 
> You don't need this line, it tests if the assembler supports p9.
> 
>> +/* { dg-final { scan-assembler-times "maddld " 2 } } */
>> +/* { dg-final { scan-assembler-not   "mulld "    } } */
>> +/* { dg-final { scan-assembler-not   "add "      } } */
> 
> You can easier write this using \m and \M, a bit more exact even:
> 
> /* { dg-final { scan-assembler-times {\mmaddld\M} 2 } } *As the file name is madld-1.c, the resulting assembly file contains

    .file   "maddld-1.c"

This will cause the test case to fail.

I will replace it with the following statement
/* { dg-final { scan-assembler-times {\mmaddld\s} 2 } }
> /* { dg-final { scan-assembler-not   {\mmul} } } */
> /* { dg-final { scan-assembler-not   {\madd} } } */
> 
> Which allows only the exact mnemonic "maddld", and disallows anything
> starting with "mul" or "add".
> 
> Okay for trunk, with the testcase improvements please.  Thanks!
> 
> 
> Segher
> 



More information about the Gcc-patches mailing list