Skip to content

Commit 28b01c5

Browse files
committed
[hexagon] Add {hvx,}hexagon_{protos,circ_brev...}
Add definitions for Hexagon, Hexagon circular/bit-reverse and HVX intrinsics.
1 parent ae7c395 commit 28b01c5

File tree

8 files changed

+15898
-0
lines changed

8 files changed

+15898
-0
lines changed

clang/lib/Headers/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ set(files
6666
fmaintrin.h
6767
fxsrintrin.h
6868
gfniintrin.h
69+
hexagon_circ_brev_intrinsics.h
70+
hexagon_protos.h
71+
hexagon_types.h
72+
hvx_hexagon_protos.h
6973
hresetintrin.h
7074
htmintrin.h
7175
htmxlintrin.h

clang/lib/Headers/hexagon_circ_brev_intrinsics.h

Lines changed: 298 additions & 0 deletions
Large diffs are not rendered by default.

clang/lib/Headers/hexagon_protos.h

Lines changed: 8450 additions & 0 deletions
Large diffs are not rendered by default.

clang/lib/Headers/hexagon_types.h

Lines changed: 2653 additions & 0 deletions
Large diffs are not rendered by default.

clang/lib/Headers/hvx_hexagon_protos.h

Lines changed: 4392 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// REQUIRES: hexagon-registered-target
2+
3+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
4+
// RUN: -target-cpu hexagonv67t -triple hexagon-unknown-elf \
5+
// RUN: -emit-llvm %s -o - | FileCheck %s
6+
7+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
8+
// RUN: -target-cpu hexagonv67t -triple hexagon-unknown-elf -x c++ \
9+
// RUN: -emit-llvm %s -o - | FileCheck %s
10+
11+
// RUN: not %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
12+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf -x c++ \
13+
// RUN: -fsyntax-only %s 2>&1 | FileCheck --implicit-check-not='error:' \
14+
// RUN: --check-prefix=CHECK-ERR-CXX %s
15+
16+
// RUN: not %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
17+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf -std=c99 \
18+
// RUN: -Wimplicit-function-declaration -Werror -fsyntax-only %s 2>&1 | \
19+
// RUN: FileCheck --implicit-check-not='error:' --check-prefix=CHECK-ERR-C99 %s
20+
21+
#include <hexagon_protos.h>
22+
23+
void test_audio() {
24+
unsigned int b;
25+
unsigned long long c;
26+
27+
// CHECK-ERR-CXX: error: use of undeclared identifier 'Q6_R_clip_RI'
28+
// CHECK-ERR-C99: error: implicit declaration of function 'Q6_R_clip_RI' is invalid in C99
29+
// CHECK: call i32 @llvm.hexagon.A7.clip
30+
b = Q6_R_clip_RI(b, 9);
31+
32+
// CHECK-ERR-CXX: error: use of undeclared identifier 'Q6_P_cround_PI'
33+
// CHECK-ERR-C99: error: implicit declaration of function 'Q6_P_cround_PI' is invalid in C99
34+
// CHECK: call i64 @llvm.hexagon.A7.cround
35+
c = Q6_P_cround_PI(c, 12);
36+
}

clang/test/Headers/hexagon-headers.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// REQUIRES: hexagon-registered-target
2+
3+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
4+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf \
5+
// RUN: -emit-llvm %s -o - | FileCheck %s
6+
7+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
8+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf -x c++ \
9+
// RUN: -emit-llvm %s -o - | FileCheck %s
10+
11+
#include <hexagon_protos.h>
12+
13+
// expected-no-diagnostics
14+
15+
void test_protos(float a, unsigned int b) {
16+
unsigned char c;
17+
// CHECK: call i64 @llvm.hexagon.A2.absp
18+
b = Q6_P_abs_P(b);
19+
}
20+
21+
void test_dma() {
22+
unsigned int b;
23+
24+
// CHECK: call i32 @llvm.hexagon.Y6.dmpoll
25+
b = Q6_R_dmpoll();
26+
// CHECK: call i32 @llvm.hexagon.Y6.dmpause
27+
b = Q6_R_dmpause();
28+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// REQUIRES: hexagon-registered-target
2+
3+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
4+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf \
5+
// RUN: -target-feature +hvx-length128b -target-feature +hvxv68 \
6+
// RUN: -emit-llvm %s -o - | FileCheck --check-prefix=CHECK %s
7+
8+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
9+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf -DDIRECT \
10+
// RUN: -target-feature +hvx-length128b -target-feature +hvxv68 \
11+
// RUN: -emit-llvm %s -o - | FileCheck --check-prefix=CHECK %s
12+
13+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
14+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf -x c++ \
15+
// RUN: -target-feature +hvx-length128b -target-feature +hvxv68 \
16+
// RUN: -emit-llvm %s -o - | FileCheck --check-prefix=CHECK %s
17+
18+
// RUN: %clang_cc1 -O0 -internal-isystem %S/../../lib/Headers/ \
19+
// RUN: -target-cpu hexagonv68 -triple hexagon-unknown-elf \
20+
// RUN: -target-feature +hvx-length64b -target-feature +hvxv68 \
21+
// RUN: -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-64 %s
22+
23+
#ifdef DIRECT
24+
#include <hvx_hexagon_protos.h>
25+
#else
26+
#include <hexagon_protos.h>
27+
#endif
28+
#include <hexagon_types.h>
29+
30+
// expected-no-diagnostics
31+
32+
void test_hvx_protos(float a, unsigned int b) {
33+
HVX_VectorPair c;
34+
// CHECK-64: call <32 x i32> @llvm.hexagon.V6.v6mpyhubs10
35+
// CHECK: call <64 x i32> @llvm.hexagon.V6.v6mpyhubs10.128B
36+
c = Q6_Ww_v6mpy_WubWbI_h(c, c, 12);
37+
}

0 commit comments

Comments
 (0)