[llvm] r261360 - Fix incorrect selection of AVX512 sqrt when OptForSize is on

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 13:39:47 PST 2016


On Fri, Feb 19, 2016 at 12:21 PM, Dimitry Andric <dimitry at andric.com> wrote:
> On 19 Feb 2016, at 21:14, Dimitry Andric via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: dim
>> Date: Fri Feb 19 14:14:11 2016
>> New Revision: 261360
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261360&view=rev
>> Log:
>> Fix incorrect selection of AVX512 sqrt when OptForSize is on
>>
>> Summary:
>> When optimizing for size, sqrt calls can be incorrectly selected as
>> AVX512 VSQRT instructions.  This is because X86InstrAVX512.td has a
>> `Requires<[OptForSize]>` in its `avx512_sqrt_scalar` multiclass
>> definition.  Even if the target does not support AVX512, the class can
>> apparently still be chosen, leading to an incorrect selection of
>> `vsqrtss`.
>>
>> In PR26625, this lead to an assertion: Reg >= X86::FP0 && Reg <=
>> X86::FP6 && "Expected FP register!", because the `vsqrtss` instruction
>> requires an XMM register, which is not available on i686 CPUs.
>>
>> Reviewers: grosbach, resistor, joker.eph
>>
>> Subscribers: spatel, emaste, llvm-commits
>>
>> Differential Revision: http://reviews.llvm.org/D17414
>
> Hans, this one would be nice to get into 3.8.  I am unsure who the owner of the .td files is though.  Since it is under the X86 target, is the owner Nadav Rotem?

This seems like a straight-forward fix. I've merged it in r261367.

Thanks,
Hans


More information about the llvm-commits mailing list