-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV][Clang] Add C API header for elw CORE-V intrinsics.
This commit adds the C API header to serve as an interface for the intrinsic functions provided with the CORE-V xcvelw extension. The commit includes the addition of the header itself and a clang CodeGen test that checks the integrity of the call to the wrapper functions designed in the C API CORE-V elw header.
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,7 @@ set(ppc_htm_files | |
|
||
set(riscv_files | ||
riscv_corev_bitmanip.h | ||
riscv_corev_elw.h | ||
) | ||
|
||
set(systemz_files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*===---- riscv_corev_elw.h - CORE-V event load intrinsics -----------------=== | ||
* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*===-----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#ifndef __RISCV_COREV_ELW_H | ||
#define __RISCV_COREV_ELW_H | ||
|
||
#include <stdint.h> | ||
|
||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif | ||
|
||
#if defined(__riscv_xcvelw) | ||
|
||
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) | ||
|
||
static __inline__ unsigned long __DEFAULT_FN_ATTRS __riscv_cv_elw_elw(void *loc) { | ||
return __builtin_riscv_cv_elw_elw(loc); | ||
} | ||
|
||
#endif // defined(__riscv_xcvelw) | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif | ||
|
||
#endif // define __RISCV_COREV_ELW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clang_cc1 -triple riscv32 -target-feature +xcvelw -emit-llvm %s -o - \ | ||
// RUN: | FileCheck %s | ||
|
||
#include <stdint.h> | ||
#include <riscv_corev_elw.h> | ||
|
||
// CHECK-LABEL: @test_elw | ||
// CHECK: @llvm.riscv.cv.elw.elw | ||
uint32_t test_elw(void *a) { | ||
return __riscv_cv_elw_elw(a); | ||
} |