Fix LowerSDIV24

Jan Vesely jan.vesely at rutgers.edu
Thu Jul 10 06:28:31 PDT 2014


On Wed, 2014-07-09 at 23:44 -0700, Matt Arsenault wrote:
> On Jul 9, 2014, at 11:15 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:
> 
> > 
> > On Jun 26, 2014, at 3:43 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> > 
> >> On Wed, 2014-06-25 at 21:48 -0700, Matt Arsenault wrote:
> >>> Hi,
> >>> 
> >>> These reenable LowerSDIV24 to optimize division when it’s know
> >>> converting to float won’t lose precision + piglit test cases that
> >>> should break for values where this isn’t OK
> >> 
> >> Have you considered applying this to SDVIREM?
> >> getting Rem part is easy, we only need MULADD (before or after
> >> conversion to INT).
> >> 
> > 

> > I think that would be pointless. Expanded SREM with a custom SDIV
> > will expand to be the same X - Y * (X / Y), and then the division will
> > be handled this way. I’ll add a test that shows this ends up getting
> > used with stem
> 
> Actually, since SDIVREM is custom now, that is chosen first to expand
> SREM over X - Y * (X / Y). I can either move this into a LowerSDIVREM,
> and add the expansion there, or move the existing divrems to be just
> div if all they are doing for the rem part is this.

I think we need to move i24 handling to SDIVREM since i32 and i64 algs
for udivrem produce rem values as a side product and don't do X - Y *
(X / Y).

All llvm tests and piglits 'scalar-arithmetic-(u)int' still pass for me
with the attached patches applied on top of yours.

regards,
Jan

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-R600-Use-i24-sdiv-in-sdivrem-path.patch
Type: text/x-patch
Size: 2308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/e403c0fa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-R600-Remove-unused-code.patch
Type: text/x-patch
Size: 6959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/e403c0fa/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140710/e403c0fa/attachment.sig>


More information about the llvm-commits mailing list