[LLVMdev] vector type legalization

Redmond, Paul paul.redmond at intel.com
Mon Aug 12 15:07:24 PDT 2013



From: Nadav Rotem <nrotem at apple.com<mailto:nrotem at apple.com>>
Date: Monday, 12 August, 2013 4:52 PM
To: Paul Redmond <paul.redmond at intel.com<mailto:paul.redmond at intel.com>>
Cc: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>>
Subject: Re: [LLVMdev] vector type legalization


On Aug 12, 2013, at 1:47 PM, Redmond, Paul <paul.redmond at intel.com<mailto:paul.redmond at intel.com>> wrote:

Thanks for the tip. I modified WidenVecRes_Binary match WidenVecRes_{Unary/Ternary} and it does the promotion and generates much better code. Why is WidenVecRes_Binary so much more complicated than the Unary/Binary functions? None of the operations in the cases for WidenVecRes_Binary seem any more special then the operations that use WidenVecRes_Unary..

I am not sure :)

The reason is special handling for DIV and REM which can trap. The TargetLowering function canOpTrap is only used in WidenVecRes_Binary and the default behaviour returns true for the DIV and REM ops (no target seems to overload this behaviour). The Unary and Ternary functions just assume those operations don't trap.

An easy fix is to simply split WidenVecRes_Binary into two functions—one that keeps the behaviour of handling ops that trap and one that assumes no traps. I'll prepare a patch.

paul




More information about the llvm-dev mailing list