diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c --- a/compiler-rt/lib/profile/InstrProfilingUtil.c +++ b/compiler-rt/lib/profile/InstrProfilingUtil.c @@ -19,6 +19,12 @@ #include #include #include +#ifdef __ve__ +// VE doesn't support madvise. VE doesn't support paging, therefore VE's +// madvise syscall returns success always. VEOS doesn't define MADV_DONTNEED, +// so defines it here. +#define MADV_DONTNEED 4 +#endif #endif #ifdef COMPILER_RT_HAS_UNAME diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c @@ -6,6 +6,10 @@ #include "fp_lib.h" int test__compiler_rt_logb(fp_t x) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_logb(x); fp_t libm_value = logb(x); // Compare the values, considering all NaNs equivalent, as the spec doesn't diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_logbf_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_logbf_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_logbf_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_logbf_test.c @@ -7,6 +7,10 @@ #include int test__compiler_rt_logbf(fp_t x) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_logbf(x); fp_t libm_value = logbf(x); // `!=` operator on fp_t returns false for NaNs so also check if operands are diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c @@ -9,6 +9,10 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) int test__compiler_rt_logbl(fp_t x) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_logbl(x); fp_t libm_value = logbl(x); // Compare the values, considering all NaNs equivalent, as the spec doesn't diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbn_test.c @@ -9,6 +9,10 @@ #include "fp_lib.h" int test__compiler_rt_scalbn(const char *mode, fp_t x, int y) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_scalbn(x, y); fp_t libm_value = scalbn(x, y); // Consider +/-0 unequal, but disregard the sign/payload of NaN. diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnf_test.c @@ -9,6 +9,10 @@ #include "fp_lib.h" int test__compiler_rt_scalbnf(const char *mode, fp_t x, int y) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_scalbnf(x, y); fp_t libm_value = scalbnf(x, y); // Consider +/-0 unequal, but disregard the sign/payload of NaN. diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c --- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c +++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c @@ -11,6 +11,10 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) int test__compiler_rt_scalbnl(const char *mode, fp_t x, int y) { +#if defined(__ve__) + if (fpclassify(x) == FP_SUBNORMAL) + return 0; +#endif fp_t crt_value = __compiler_rt_scalbnl(x, y); fp_t libm_value = scalbnl(x, y); // Consider +/-0 unequal, but disregard the sign/payload of NaN. diff --git a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c --- a/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c +++ b/compiler-rt/test/builtins/Unit/enable_execute_stack_test.c @@ -5,6 +5,11 @@ #include #include #include + +#if defined(__ve__) +#define INSTR_ALIGNMENT_BYTE 8 +#endif + extern void __clear_cache(void* start, void* end); extern void __enable_execute_stack(void* addr); @@ -29,7 +34,11 @@ int main() { +#if defined(INSTR_ALIGNMENT_BYTE) + unsigned char execution_buffer[128] __attribute__((__aligned__(INSTR_ALIGNMENT_BYTE))); +#else unsigned char execution_buffer[128]; +#endif // mark stack page containing execution_buffer to be executable __enable_execute_stack(execution_buffer);