[llvm-dev] [GlobalISel] Narrowing uneven/non-pow-2 types

Dominik Montada via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 24 09:24:42 PDT 2020


Hi all,

recently when working with GlobalISel we have often encountered cases in 
the legalizer where instructions could not be narrowed because the 
narrowing code relies on G_UNMERGE_VALUES and therefore requires the 
source type to be a multiple of the narrow type. Often times these 
instructions can be widened without any problem to a fitting type.

This has us writing legalization rules like `.widenScalarToNextPow2(0, 
/*MinSize*/ 32).maxScalar(0, s32)` instead of the much simpler 
`.clampScalar(0, s32 ,s32)`.

Although this works and has the desired effect, we feel like that such a 
rule requires internal knowledge of the legalizer, which can change at 
any point in the future. Ideally we would only want to say `clampScalar` 
and let the legalizer handle the rest, even if it requires extending the 
type before it can be narrowed.

We were now wondering if such a behavior in the legalizer is even 
desired? I.e. that an instruction is extended to an easier-to-handle 
type even though narrowing was requested (as long as the narrowing is 
done in the end)?

Would be great to get some feedback so we know whether we can start 
adding support for some instructions or if we just need to rewrite some 
of our legalization rules using the internal knowledge.

Regards,

Dominik

-- 
----------------------------------------------------------------------
Dominik Montada                   Email: dominik.montada at hightec-rt.com
HighTec EDV-Systeme GmbH          Phone: +49 681 92613 19
Europaallee 19                    Fax:   +49-681-92613-26
D-66113 Saarbr├╝cken               WWW: http://www.hightec-rt.com

Managing Director: Vera Strothmann
Register Court: Saarbr├╝cken, HRB 10445, VAT ID: DE 138344222

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient please notify the sender immediately
and destroy this e-mail. Any unauthorised copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
---

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200324/3a64c021/attachment-0001.bin>


More information about the llvm-dev mailing list