Widening multiplication, but no narrowing division [i386/AMD64]
Paul Koning
paulkoning@comcast.net
Mon Jan 9 15:30:30 GMT 2023
> On Jan 9, 2023, at 10:20 AM, Stefan Kanthak <stefan.kanthak@nexgo.de> wrote:
>
> "Paul Koning" <paulkoning@comcast.net> wrote:
>
>>> On Jan 9, 2023, at 7:20 AM, Stefan Kanthak <stefan.kanthak@nexgo.de> wrote:
>>>
>>> Hi,
>>>
>>> GCC (and other C compilers too) support the widening multiplication
>>> of i386/AMD64 processors, but DON'T support their narrowing division:
>>
>> I wonder if this changed in the recent past.
>> I have a pattern for this type of thing in pdp11.md:
> [...]
>> and I'm pretty sure this worked at some point in the past.
>
> Unfortunately the C standard defines that the smaller operand (of lesser
> conversion rank), here divisor, has to undergo a conversion to the "real
> common type", i.e. the broader operand (of higher conversion rank), here
> dividend. Unless the information about promotion/conversion is handed over
> to the code generator it can't apply such patterns -- as demonstrated by
> the demo code.
>
> regards
> Stefan
Yes, I was thinking the same. But I spent a while on that pattern -- I wanted to support div/mod as a single operation because the machine has that primitive. And I'm pretty sure I saw it work before I committed that change. That's why I'm wondering if something changed.
paul
More information about the Gcc
mailing list