[PATCH] Adding TableGen patterns to auto-select TBM instructions

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Wed Oct 2 12:51:05 PDT 2013

Never mind. A clever trick is to just add an explicit cast to tbmintrin.h. Ahh I was not thinking straight.

From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] on behalf of Gao, Yunzhong
Sent: Wednesday, October 02, 2013 12:42 PM
To: Craig Topper
Cc: llvm-commits at cs.uiuc.edu
Subject: RE: [PATCH] Adding TableGen patterns to auto-select TBM instructions

Yes this patch works without the extra instructions, but I have a little concern.

/* test case */
unsigned long long test__bextri_u64(unsigned long long a) {
   return __bextri_u64(a, 0x7fffffffffLL);

With this cfe patch, if I pass a large integer constant to %llvm.x86.tbm.bextri.u64, the front end is not going to convert it
to i32imm, but the backend will not be able to match it to i64immSExt32 either. So I see an error like this:
fatal error: error in backend: Cannot select: intrinsic %llvm.x86.tbm.bextri.u64

I wonder if there is any clever front end trick I can make to tbmintrin.h. Right now the intrinsic is just a macro to allow
immediates to be passed to the builtin function.

- Gao.

From: Craig Topper [craig.topper at gmail.com]
Sent: Tuesday, October 01, 2013 11:03 PM
To: Gao, Yunzhong
Cc: llvm-commits at cs.uiuc.edu; Craig Topper
Subject: Re: [PATCH] Adding TableGen patterns to auto-select TBM instructions

I think these patches work without the need for the extra instructions.

On Tue, Oct 1, 2013 at 10:23 PM, Craig Topper <craig.topper at gmail.com<mailto:craig.topper at gmail.com>> wrote:

  I say we just redefine the llvm side intrinsic to take an i64 immediate that we check to ensure its only really 32-bits. Keep the header file intrinsic taking an int and let it get implicitly extended when the __builtin function is called.



llvm-commits mailing list
llvm-commits at cs.uiuc.edu

More information about the llvm-commits mailing list