r337619 added __shiftleft128 / __shiftright128 as functions in intrin.h. Microsoft's STL plans on using these functions, and they're using intrin0.h which just has declarations of built-ins to not pull in the huge intrin.h header in the standard library headers. That requires that these functions are real built-ins.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
(I tried using funnelshift for this as mentioned in the FIXME, but it looks like it still produces a bunch of unnecessary code if the shift amount isn't constant.)
Comment Actions
Oh, and I verified that this still gets compiled to shld / shrd:
Nicos-MacBook-Pro:llvm-mono thakis$ cat test.c #include <intrin.h> unsigned __int64 test__shiftleft128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { return __shiftleft128(l, h, d); } unsigned __int64 test__shiftright128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { return __shiftright128(l, h, d); } Nicos-MacBook-Pro:llvm-mono thakis$ ./clang-cl.sh /O2 /c test.c /FA ; cat test.asm .text .intel_syntax noprefix .def test__shiftleft128; .scl 2; .type 32; .endef .section .text,"xr",one_only,test__shiftleft128 .globl test__shiftleft128 # -- Begin function test__shiftleft128 .p2align 4, 0x90 test__shiftleft128: # @test__shiftleft128 # %bb.0: # %entry mov rax, rcx mov ecx, r8d shld rdx, rax, cl mov rax, rdx ret # -- End function .def test__shiftright128; .scl 2; .type 32; .endef .section .text,"xr",one_only,test__shiftright128 .globl test__shiftright128 # -- Begin function test__shiftright128 .p2align 4, 0x90 test__shiftright128: # @test__shiftright128 # %bb.0: # %entry mov rax, rcx mov ecx, r8d shrd rax, rdx, cl ret # -- End function .section .drectve,"yn" .ascii " /DEFAULTLIB:libcmt.lib" .ascii " /DEFAULTLIB:oldnames.lib"