Commit Graph

375 Commits

Author SHA1 Message Date
Manman Ren add5e9e289 X86: add GATHER intrinsics (AVX2) in Clang
Support the following intrinsics:
  _mm_mask_i32gather_pd, _mm256_mask_i32gather_pd, _mm_mask_i64gather_pd
  _mm256_mask_i64gather_pd, _mm_mask_i32gather_ps, _mm256_mask_i32gather_ps
  _mm_mask_i64gather_ps, _mm256_mask_i64gather_ps

llvm-svn: 159222
2012-06-26 19:55:09 +00:00
NAKAMURA Takumi f500be025a Headers/xopintrin.h: Try to fix r158492. Did you mean, mm256?
llvm-svn: 158521
2012-06-15 13:37:44 +00:00
Craig Topper 9e28bf9345 Add XOP frcz instrinsics.
llvm-svn: 158492
2012-06-15 06:33:42 +00:00
Craig Topper db0fbf0a50 Add XOP permute intrinsics.
llvm-svn: 158351
2012-06-12 06:03:35 +00:00
Craig Topper ce8dbaadb6 Add XOP shift and compare intrinsics.
llvm-svn: 158300
2012-06-11 07:01:43 +00:00
Craig Topper a3c5fbf54b Add XOP vprot* instruction intrinsics
llvm-svn: 158292
2012-06-10 07:47:32 +00:00
Craig Topper 02b3d81a97 More XOP intrinsics
llvm-svn: 158287
2012-06-10 02:46:15 +00:00
Craig Topper 33b6d5e20b Begin adding XOP intrinsics
llvm-svn: 158286
2012-06-10 00:39:38 +00:00
Craig Topper 2b1eda344a Add fma3 intrinsic header file.
llvm-svn: 157913
2012-06-04 03:42:47 +00:00
Craig Topper 3f122a7636 Add builtin for pclmulqdq instruction.
llvm-svn: 157733
2012-05-31 05:18:48 +00:00
Craig Topper 9fd12db1c0 Update FIXME. ABM is already covered by LZCNT and POPCNT.
llvm-svn: 157676
2012-05-30 04:49:49 +00:00
Benjamin Kramer 1ab16ba501 Install ammintrin.h in the cmake build.
llvm-svn: 157639
2012-05-29 19:36:17 +00:00
Benjamin Kramer ba6e2528fa Add an ammintrin.h header for SSE4a intrinsics.
This is a clean-room implementation based on public documentation and
I tried to validate it as much as possible against gcc.

llvm-svn: 157638
2012-05-29 19:10:17 +00:00
Chandler Carruth 4496c44e5f Remove the 'intrin.h' builtin header file and its tests for now.
After discussion with several people, including Doug Gregor, we've
decided to change our approach here. If you have questions about this
header file, the commit removing it, etc., please reach out to me
off-list.

llvm-svn: 156322
2012-05-07 20:46:58 +00:00
Chad Rosier 87622b8b84 Get rid of storelv4si builtin as it can be expressed directly. This is general
goodness because it provides opportunites to cleanup things.  For example,

uint64_t t1(__m128i vA)
{
  uint64_t Alo;
  _mm_storel_epi64((__m128i*)&Alo, vA);
  return Alo;
}

was generating 

	movq	%xmm0, -8(%rbp)
	movq	-8(%rbp), %rax

and now generates

	movd	%xmm0, %rax

rdar://11282581

llvm-svn: 155924
2012-05-01 18:11:51 +00:00
Nico Weber cb93142e1f Expand #include_next in float.h from mingw to _msc_ver.
A test for this is checking if this compiles:

    #include <float.h>

    inline bool IsFinite(const double& number) {
     return _finite(number) != 0;
    }

That depends however on either mingw or msvc being installed, and
chapuni tells me there might be issues with float.h on mingw, so
no automated test is added.

llvm-svn: 155507
2012-04-24 23:43:40 +00:00
Nico Weber 1d725ecf93 Let NULL and MSVC headers coexist better.
Fixes the two issues mentioned in PR12146.

llvm-svn: 155490
2012-04-24 21:27:01 +00:00
Aaron Ballman 0ae8c946a4 Adding information about what intrinsics still need to be implemented for MSVC compatibility.
llvm-svn: 155441
2012-04-24 12:30:37 +00:00
Chandler Carruth ff90611253 Fix a typo spotted by Matt.
llvm-svn: 155427
2012-04-24 05:59:48 +00:00
Chandler Carruth 3dfb6d84c6 Introduce an initial sketch of a MSVC compatible 'intrin.h' builtin
header, along with a stub test to make sure it compiles in the
appropriate modes.

Thanks to Aaron Ballman for working with me to figure out the initial
strategy here, and to Nico for reviewing and pestering me to actually
commit it.

llvm-svn: 155425
2012-04-24 05:23:54 +00:00
Craig Topper 26e74e50b6 Convert vperm2f128 and vperm2i128 intrinsics back to using llvm intrinsics. Unfortunately, these instructions have behavior that can't be modeled with shuffle vector.
llvm-svn: 154906
2012-04-17 05:16:56 +00:00
Craig Topper 8e57855ea0 Change _mm256_permute4x64_epi64 and _mm256_permute4x64_pd to use builtin_shufflevector instead of specific builtins. Old builtins will be removed from llvm now that vpermq/vpermpd are supported by shuffle lowering code.
llvm-svn: 154777
2012-04-15 22:18:10 +00:00
Chad Rosier 2c5154224b Fix the signatures for the _mm256_storeu2_* intrinsics.
PR12532

llvm-svn: 154591
2012-04-12 16:29:08 +00:00
Craig Topper 74c17c65e4 Correctly check argument types for some vector macros in smmintrin.h. Put parentheses around uses of vector macro arguments.
llvm-svn: 153732
2012-03-30 07:01:17 +00:00
Craig Topper 97f042f2d6 Add _mm_minpos_epu16 to smmintrin.h. Fixes PR12399.
llvm-svn: 153726
2012-03-30 05:41:28 +00:00
Craig Topper 678a53c350 Fix shuffle vector calculation for mm_permute_ps. Fixes PR 12401.
llvm-svn: 153724
2012-03-30 05:09:18 +00:00
Rafael Espindola c31d004ece unwind.h fix for -fvisibility=hidden users. This fixes firefox build in a system
with libunwind installed.
Patch by Jeffrey Yasskin!

llvm-svn: 153633
2012-03-29 03:37:17 +00:00
Chad Rosier f8df4f4e3b [avx] Define the _mm256_loadu2_xxx and _mm256_storeu2_xxx intrinsics.
From the Intel Optimization Reference Manual, Section 11.6.2.  When data cannot
be aligned or alignment is not known, 16-byte memory accesses may provide better
performance.
rdar://11076953

llvm-svn: 153091
2012-03-20 16:40:00 +00:00
Howard Hinnant ebab2b0660 * tgmath_logb.patch implements the missing logb function (see C99 standard 7.22, paragraph 5). * tgmath_fabs_complex.patch corrects the return types for the complex fabs functions. These must be non-complex float/double/long double (see C99 standard 7.22, paragraph 4 and 7.3.8.1). Patch contributed by Kristof Beyls.
llvm-svn: 151276
2012-02-23 20:22:10 +00:00
Jeffrey Yasskin a09e62a042 Allow linux builds to take advantage of libunwind to get unwind.h if
that's installed.

llvm-svn: 151058
2012-02-21 16:20:12 +00:00
Chandler Carruth a2a5410e6d Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
match the behavior of GCC. Also add a test for these intrinsics, which
apparently have *zero* tests. =[ Not surprisingly, Clang crashed when
compiling these.

Fix the bug in CodeGen where we failed to bitcast the argument type to
x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the
new 3dnow-builtins.c test.

This is one issue impacting the efforts to get Clang to emulate the
Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made
available there.

llvm-svn: 150948
2012-02-20 07:35:45 +00:00
Craig Topper e5ea3b0239 Remove vperm2f* and vperm2i builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150064
2012-02-08 07:33:36 +00:00
Craig Topper fec9f8edb7 Remove vpermilp* builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150056
2012-02-08 05:16:54 +00:00
Eli Friedman 96efec99eb Add C11 FLT_TRUE_MIN and friends. <rdar://problem/10812837>.
llvm-svn: 149949
2012-02-07 01:02:19 +00:00
Nick Lewycky d0ba3793aa Comment mystery code.
llvm-svn: 149742
2012-02-04 02:16:48 +00:00
Nick Lewycky 51a009092c Make _mm_cmpgt_epi8 immute to -funsigned-char.
llvm-svn: 149725
2012-02-03 23:57:48 +00:00
Douglas Gregor 3ec6663be0 Back out my heinous hack that tricked the module generation mechanism
into using non-absolute system includes (<foo>)...

... and introduce another hack that is simultaneously more heineous
and more effective. We whitelist Clang-supplied headers that augment
or override system headers (such as float.h, stdarg.h, and
tgmath.h). For these headers, Clang does not provide a module
mapping. Instead, a system-supplied module map can refer to these
headers in a system module, and Clang will look both in its own
include directory and wherever the system-supplied module map
suggests, then adds either or both headers. The end result is that
Clang-supplied headers get merged into the system-supplied module for
the C standard library.

As a drive-by, fix up a few dependencies in the _Builtin_instrinsics
module.

llvm-svn: 149611
2012-02-02 18:42:48 +00:00
Douglas Gregor 232e3431e2 Split compiler builtin module into "stdlib" builtins and "intrinsic"
builds, and bring mm_alloc.h into the fold. Start playing some tricks
with these builtin modules to mirror the include_next tricks that the
headers already perform.

llvm-svn: 149434
2012-01-31 21:57:50 +00:00
Douglas Gregor 56435b49e0 Remove tgmath.h from the module map for now, because it currently causes a
cyclic module dependency due to its inclusion of math.h and
complex.h. I'll take another shot at it later.

llvm-svn: 149283
2012-01-30 22:22:39 +00:00
Douglas Gregor 71022cac1f Fix typo spotted by Sebastian. Thanks!
llvm-svn: 149257
2012-01-30 18:49:05 +00:00
Craig Topper d6d3a05b4f Cleanup 3dnow builtin handling. Most of them were already handled by LLVM connecting intrinsics and builtins in IntrinsicsX86.td.
llvm-svn: 149233
2012-01-30 08:18:19 +00:00
Douglas Gregor 0070c0bfbe Introduce TargetInfo::hasFeature() to query various feature names in
each of the targets. Use this for module requirements, so that we can
pin the availability of certain modules to certain target features,
e.g., provide a module for xmmintrin.h only when SSE support is
available.

Use these feature names to provide a nearly-complete module map for
Clang's built-in headers. Only mm_alloc.h and unwind.h are missing,
and those two are fairly specialized at the moment. Finishes
<rdar://problem/10710060>.

llvm-svn: 149227
2012-01-30 06:38:25 +00:00
Douglas Gregor c93a872206 Just disable the compiler-builtins module test on MSVC for now
llvm-svn: 149214
2012-01-29 23:53:54 +00:00
Douglas Gregor e8f900bdcc Teach tgmath.h to only include <complex.h> if it's available.
llvm-svn: 149213
2012-01-29 23:40:50 +00:00
Douglas Gregor 80928be137 Alternate fix to the modules failures that doesn't require us to tweak tgmath.h
llvm-svn: 149210
2012-01-29 22:47:19 +00:00
Douglas Gregor b9f9aea13c If there's no math.h, then tgmath.h should just be empty
llvm-svn: 149209
2012-01-29 22:35:57 +00:00
Douglas Gregor 3f09de6442 Introduce a module map for (some of) the compiler-supplied
headers. The remaining headers require more sophisticated
requirements; they'll be handled separately. Part of
<rdar://problem/10710060>.

llvm-svn: 149206
2012-01-29 20:52:14 +00:00
Craig Topper 9e9301a83a Represent 256-bit unaligned loads natively and remove the builtins. Similar change was made for 128-bit versions a while back.
llvm-svn: 148919
2012-01-25 04:26:17 +00:00
Douglas Gregor 38f3981a99 On Darwin, use the system's <unwind.h> whenever it is
available. Clang's <unwind.h> isn't ready for prime time. Fixes
<rdar://problem/10733587>.

llvm-svn: 148807
2012-01-24 15:12:50 +00:00
Bob Wilson 51897ec79b Fix a typo: _MM_FLUSH_ZERO_OFF has the wrong value. rdar://10716672
llvm-svn: 148711
2012-01-23 18:27:24 +00:00