]> granicus.if.org Git - llvm/commit
[CGP] form usub with overflow from sub+icmp
authorSanjay Patel <spatel@rotateright.com>
Mon, 18 Feb 2019 23:33:05 +0000 (23:33 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 18 Feb 2019 23:33:05 +0000 (23:33 +0000)
commit09f3b5ecb16e50d1752dbb57a0d0c3c170dd5537
treea84af8312ba07a1c122bb572bbcfaf1f64b83972
parent1e3c4790abc355a619d0c778bfd5f599e5ec2df4
[CGP] form usub with overflow from sub+icmp

The motivating x86 cases for forming the intrinsic are shown in PR31754 and PR40487:
https://bugs.llvm.org/show_bug.cgi?id=31754
https://bugs.llvm.org/show_bug.cgi?id=40487
..and those are shown in the IR test file and x86 codegen file.

Matching the usubo pattern is harder than uaddo because we have 2 independent values rather than a def-use.

This adds a TLI hook that should preserve the existing behavior for uaddo formation, but disables usubo
formation by default. Only x86 overrides that setting for now although other targets will likely benefit
by forming usbuo too.

Differential Revision: https://reviews.llvm.org/D57789

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354298 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/TargetLowering.h
lib/CodeGen/CodeGenPrepare.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
test/CodeGen/X86/cgp-usubo.ll
test/CodeGen/X86/lsr-loop-exit-cond.ll
test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll