On Tue, Jul 19, 2011 at 2:16 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
> On Tue, Jul 19, 2011 at 10:46 AM, Richard Guenther
> <richard.guent...@gmail.com> wrote:
>
>>>>>>>>> TARGET_MEM_REF only works on ptr_mode.   This patch allows 32bit 
>>>>>>>>> address
>>>>>>>>> in x32 mode.  OK for trunk?
>>>>>>>>
>>>>>>>> Do you perhaps have a testcase to help in analyzing the problem?
>>>>>>>>
>>>>>>>
>>>>>>> See:
>>>>>>>
>>>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49780
>>>>>>
>>>>>> I don't think that tree-ssa-address/addr_for_mem_ref is correct when
>>>>>> REALLY_EXPAND is false. It constructs RTX "template" in pointer_mode,
>>>>>> which is not necessary valid and is rejected from
>>>>>> ix86_validate_address_p. When really expanding the expression, we have
>>>>>> a conversion at the end:
>>>>>>
>>>>>>  gen_addr_rtx (pointer_mode, sym, bse, idx, st, off, &address, NULL, 
>>>>>> NULL);
>>>>>>  if (pointer_mode != address_mode)
>>>>>>    address = convert_memory_address (address_mode, address);
>>>>>>  return address;
>>>>>>
>>>>>> This is in fact your r175912 change in the fix for PR47383 - you need
>>>>>> to do something with template as well...
>>>>>>
>>>>>
>>>>> Since TARGET_MEM_REF only works on ptr_mode, I don't think
>>>>> we can change template.  We just need to accept TARGET_MEM_REF
>>>>> in ptr_mode and fix it up later.
>>>>
>>>> No, a template is used to get some insight into the supported address
>>>> structure. If there is a mismatch, this approach fails, we can as well
>>>> give the compiler whatever fake template we want.
>
> I have investigated other Pmode != ptr_mode targets, and none of them
> check the mode of a register in TARGET_LEGITIMATE_ADDRESS_P (or
> equivalent GO_IF_LEGITIMATE_ADDRESS). All it matters is only if there
> is a register and regno of the register.
>
> Attached patch simply removes these two checks, as it seems they are
> not needed. This also follows how other Pmode != ptr_mode targets.
>
> 2011-07-19  Uros Bizjak  <ubiz...@gmail.com>
>
>        PR target/49780
>        * config/i386/i386.c (ix86_legitimate_address_p): Remove checks that
>        base and index registers are in Pmode.
>
> Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
> {,-m32}. Can you please re-test it on x32?

Comparing with my patch, which only allows DImode and SImode,
it caused the following regressions:

FAIL: libgomp.fortran/omp_atomic1.f90  -O1  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -O2  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -O3 -fomit-frame-pointer  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -O3 -g  execution test
FAIL: libgomp.fortran/omp_atomic1.f90  -Os  execution test

> BTW: I still think that template should return the same address
> structure as expansion, but this won't crash the compiler anymore.
>
> Uros.
>



-- 
H.J.
-

Reply via email to