CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
74 lines
4.4 KiB
C
74 lines
4.4 KiB
C
// RUN: %clang_cc1 -triple loongarch64 -emit-llvm -verify %s -o /dev/null
|
|
// RUN: not %clang_cc1 -triple loongarch64 -DFEATURE_CHECK -emit-llvm %s -o /dev/null 2>&1 \
|
|
// RUN: | FileCheck %s
|
|
|
|
#include <larchintrin.h>
|
|
|
|
#ifdef FEATURE_CHECK
|
|
void test_feature(unsigned long *v_ul, int *v_i, float a, double b) {
|
|
// CHECK: error: '__builtin_loongarch_cacop_w' needs target feature 32bit
|
|
__builtin_loongarch_cacop_w(1, v_ul[0], 1024);
|
|
// CHECK: error: '__builtin_loongarch_movfcsr2gr' needs target feature f
|
|
v_i[0] = __builtin_loongarch_movfcsr2gr(1);
|
|
// CHECK: error: '__builtin_loongarch_movgr2fcsr' needs target feature f
|
|
__builtin_loongarch_movgr2fcsr(1, v_i[1]);
|
|
// CHECK: error: '__builtin_loongarch_frecipe_s' needs target feature f,frecipe
|
|
float f1 = __builtin_loongarch_frecipe_s(a);
|
|
// CHECK: error: '__builtin_loongarch_frsqrte_s' needs target feature f,frecipe
|
|
float f2 = __builtin_loongarch_frsqrte_s(a);
|
|
// CHECK: error: '__builtin_loongarch_frecipe_d' needs target feature d,frecipe
|
|
double d1 = __builtin_loongarch_frecipe_d(b);
|
|
// CHECK: error: '__builtin_loongarch_frsqrte_d' needs target feature d,frecipe
|
|
double d2 = __builtin_loongarch_frsqrte_d(b);
|
|
}
|
|
#endif
|
|
|
|
void cacop_d(int a) {
|
|
__builtin_loongarch_cacop_d(-1, a, 0); // expected-error {{argument value -1 is outside the valid range [0, 31]}}
|
|
__builtin_loongarch_cacop_d(1, a, 4000); // expected-error {{argument value 4000 is outside the valid range [-2048, 2047]}}
|
|
__builtin_loongarch_cacop_d(-2, a, 5000); // expected-error {{argument value -2 is outside the valid range [0, 31]}}
|
|
}
|
|
|
|
void csrrd_d(int a) {
|
|
__builtin_loongarch_csrrd_d(16384); // expected-error {{argument value 16384 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrrd_d(-1); // expected-error {{argument value 4294967295 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrrd_d(a); // expected-error {{argument to '__builtin_loongarch_csrrd_d' must be a constant integer}}
|
|
}
|
|
|
|
void csrwr_d(unsigned long int a) {
|
|
__builtin_loongarch_csrwr_d(a, 16384); // expected-error {{argument value 16384 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrwr_d(a, -1); // expected-error {{argument value 4294967295 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrwr_d(a, a); // expected-error {{argument to '__builtin_loongarch_csrwr_d' must be a constant integer}}
|
|
}
|
|
|
|
void csrxchg_d(unsigned long int a, unsigned long int b) {
|
|
__builtin_loongarch_csrxchg_d(a, b, 16384); // expected-error {{argument value 16384 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrxchg_d(a, b, -1); // expected-error {{argument value 4294967295 is outside the valid range [0, 16383]}}
|
|
__builtin_loongarch_csrxchg_d(a, b, b); // expected-error {{argument to '__builtin_loongarch_csrxchg_d' must be a constant integer}}
|
|
}
|
|
|
|
void lddir_d(long int a, int b) {
|
|
__builtin_loongarch_lddir_d(a, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
|
|
__builtin_loongarch_lddir_d(a, -1); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 31]}}
|
|
__builtin_loongarch_lddir_d(a, b); // expected-error {{argument to '__builtin_loongarch_lddir_d' must be a constant integer}}
|
|
}
|
|
|
|
void ldpte_d(long int a, int b) {
|
|
__builtin_loongarch_ldpte_d(a, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
|
|
__builtin_loongarch_ldpte_d(a, -1); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 31]}}
|
|
__builtin_loongarch_ldpte_d(a, b); // expected-error {{argument to '__builtin_loongarch_ldpte_d' must be a constant integer}}
|
|
}
|
|
|
|
int movfcsr2gr_out_of_lo_range(int a) {
|
|
int b = __builtin_loongarch_movfcsr2gr(-1); // expected-error {{argument value 4294967295 is outside the valid range [0, 3]}}
|
|
int c = __builtin_loongarch_movfcsr2gr(32); // expected-error {{argument value 32 is outside the valid range [0, 3]}}
|
|
int d = __builtin_loongarch_movfcsr2gr(a); // expected-error {{argument to '__builtin_loongarch_movfcsr2gr' must be a constant integer}}
|
|
return 0;
|
|
}
|
|
|
|
void movgr2fcsr(int a, int b) {
|
|
__builtin_loongarch_movgr2fcsr(-1, b); // expected-error {{argument value 4294967295 is outside the valid range [0, 3]}}
|
|
__builtin_loongarch_movgr2fcsr(32, b); // expected-error {{argument value 32 is outside the valid range [0, 3]}}
|
|
__builtin_loongarch_movgr2fcsr(a, b); // expected-error {{argument to '__builtin_loongarch_movgr2fcsr' must be a constant integer}}
|
|
}
|