This is a patch to X86TargetLowering::LowerToBT() which was hashed over on the Developers list with Intel concurring. It checks whether the -Oz (optimize for size) flag is set or whether the containing function's PGO cold attribute is set. If either are true it emits BT for tests of bits 8-31 instead of TEST. Previously, TEST was always used for bits 0-31 and BT was always used for bits 32-63. Since the BT instruction is 16b smaller than TEST for the bits 8-31 case, 32b vs 48b, and not irredeemably slower, it makes sense to use BT in cases where size matters. Similar logic is possible for BTC and BTS. However, LowerToBTC and LowerToBTS would need to be written and used and that's a larger patch. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150124/9f79c1dc/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: pat Type: application/octet-stream Size: 1314 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150124/9f79c1dc/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: tst64.c Type: text/x-csrc Size: 1579 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150124/9f79c1dc/attachment.c>
Can you transform you C file into a LLVM IR lit test? See example in test/CodeGen/X86/*.ll Thanks, Mehdi> On Jan 24, 2015, at 11:47 AM, Chris Sears <chris.sears at gmail.com> wrote: > > This is a patch to X86TargetLowering::LowerToBT() which was hashed over on the Developers list with Intel concurring. > > It checks whether the -Oz (optimize for size) flag is set or whether the containing function's PGO cold attribute is set. If either are true it emits BT for tests of bits 8-31 instead of TEST. Previously, TEST was always used for bits 0-31 and BT was always used for bits 32-63. > > Since the BT instruction is 16b smaller than TEST for the bits 8-31 case, 32b vs 48b, and not irredeemably slower, it makes sense to use BT in cases where size matters. > > Similar logic is possible for BTC and BTS. However, LowerToBTC and LowerToBTS would need to be written and used and that's a larger patch. > <pat><tst64.c>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
tst64.ll is attached from clang -S -emit-llvm tst64.c On Sat, Jan 24, 2015 at 11:56 AM, Mehdi Amini <mehdi.amini at apple.com> wrote:> Can you transform you C file into a LLVM IR lit test? > > See example in test/CodeGen/X86/*.ll > > Thanks, > > Mehdi > > > On Jan 24, 2015, at 11:47 AM, Chris Sears <chris.sears at gmail.com> wrote: > > > > This is a patch to X86TargetLowering::LowerToBT() which was hashed over > on the Developers list with Intel concurring. > > > > It checks whether the -Oz (optimize for size) flag is set or whether the > containing function's PGO cold attribute is set. If either are true it > emits BT for tests of bits 8-31 instead of TEST. Previously, TEST was > always used for bits 0-31 and BT was always used for bits 32-63. > > > > Since the BT instruction is 16b smaller than TEST for the bits 8-31 > case, 32b vs 48b, and not irredeemably slower, it makes sense to use BT in > cases where size matters. > > > > Similar logic is possible for BTC and BTS. However, LowerToBTC and > LowerToBTS would need to be written and used and that's a larger patch. > > <pat><tst64.c>_______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > >-- Ite Ursi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150124/8c3041b5/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: tst64.ll Type: application/octet-stream Size: 16154 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150124/8c3041b5/attachment.obj>