[PATCH] [2/2] Change tbm bextr builtin function to take an i64imm parameter instead of i32imm.
Craig Topper
craig.topper at gmail.com
Wed Oct 2 20:05:16 PDT 2013
LGTM
On Wed, Oct 2, 2013 at 1:32 PM, Yunzhong Gao <
Yunzhong_Gao at playstation.sony.com> wrote:
> ygao added you to the CC list for the revision "[2/2] Change tbm bextr
> builtin function to take an i64imm parameter instead of i32imm.".
>
> This makes the backend TableGen patterns slightly cleaner. An explicit
> cast is still needed in tbmintrin.h to convert any big integer down to
> i32imm. The llvm backend portion of the patch is located here:
> http://llvm-reviews.chandlerc.com/D1788
> - Gao.
>
> http://llvm-reviews.chandlerc.com/D1814
>
> Files:
> lib/Headers/tbmintrin.h
> test/CodeGen/tbm-builtins.c
> include/clang/Basic/BuiltinsX86.def
>
> Index: lib/Headers/tbmintrin.h
> ===================================================================
> --- lib/Headers/tbmintrin.h
> +++ lib/Headers/tbmintrin.h
> @@ -35,7 +35,7 @@
> #define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b)))
>
> #ifdef __x86_64__
> -#define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (b)))
> +#define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (int)(b)))
> #endif
>
> static __inline__ unsigned int __attribute__((__always_inline__,
> __nodebug__))
> Index: test/CodeGen/tbm-builtins.c
> ===================================================================
> --- test/CodeGen/tbm-builtins.c
> +++ test/CodeGen/tbm-builtins.c
> @@ -15,6 +15,11 @@
> return __bextri_u64(a, 2);
> }
>
> +unsigned long long test__bextri_u64_bigint(unsigned long long a) {
> + // CHECK: call i64 @llvm.x86.tbm.bextri.u64
> + return __bextri_u64(a, 0x7fffffffffLL);
> +}
> +
> unsigned int test__blcfill_u32(unsigned int a) {
> // CHECK: call i32 @llvm.x86.tbm.blcfill.u32
> return __blcfill_u32(a);
> Index: include/clang/Basic/BuiltinsX86.def
> ===================================================================
> --- include/clang/Basic/BuiltinsX86.def
> +++ include/clang/Basic/BuiltinsX86.def
> @@ -644,7 +644,7 @@
>
> // TBM
> BUILTIN(__builtin_ia32_bextri_u32, "UiUiIUi", "")
> -BUILTIN(__builtin_ia32_bextri_u64, "ULLiULLiIUi", "")
> +BUILTIN(__builtin_ia32_bextri_u64, "ULLiULLiIULLi", "")
> BUILTIN(__builtin_ia32_blcfill_u32, "UiUi", "")
> BUILTIN(__builtin_ia32_blcfill_u64, "ULLiULLi", "")
> BUILTIN(__builtin_ia32_blci_u32, "UiUi", "")
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131002/ee2b3d52/attachment.html>
More information about the cfe-commits
mailing list