File: simd-intrinsics-x86.cpp

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (35 lines) | stat: -rw-r--r-- 1,585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// RUN: %check_clang_tidy -std=c++11-or-later %s portability-simd-intrinsics %t -- \
// RUN:  -config='{CheckOptions: [ \
// RUN:    {key: portability-simd-intrinsics.Suggest, value: false} \
// RUN:  ]}' -- -target x86_64
// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics -check-suffix=BEFORE-CXX20 %t -- \
// RUN:  -config='{CheckOptions: [ \
// RUN:    {key: portability-simd-intrinsics.Suggest, value: true} \
// RUN:  ]}' -- -target x86_64
// RUN: %check_clang_tidy -std=c++20-or-later %s portability-simd-intrinsics -check-suffix=CXX20 %t -- \
// RUN:  -config='{CheckOptions: [ \
// RUN:    {key: portability-simd-intrinsics.Suggest, value: true} \
// RUN:  ]}' -- -target x86_64

typedef long long __m128i __attribute__((vector_size(16)));
typedef double __m256 __attribute__((vector_size(32)));

__m128i _mm_add_epi32(__m128i, __m128i);
__m256 _mm256_load_pd(double const *);
void _mm256_store_pd(double *, __m256);

int _mm_add_fake(int, int);

void X86() {
  __m128i i0, i1;
  __m256 d0;

  _mm_add_epi32(i0, i1);
  // CHECK-MESSAGES-BEFORE-CXX20: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics]
  // CHECK-MESSAGES-CXX20: :[[@LINE-2]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::simd objects [portability-simd-intrinsics]
  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: '_mm_add_epi32' is a non-portable x86_64 intrinsic function [portability-simd-intrinsics]
  d0 = _mm256_load_pd(0);
  _mm256_store_pd(0, d0);

  _mm_add_fake(0, 1);
}