Skip to content

Commit 662b130

Browse files
authored
[libc][NFC] Tighten up guard conditions for sqrt and polyeval (#93791)
Found while investigating #93709
1 parent b49c0b8 commit 662b130

File tree

3 files changed

+5
-88
lines changed

3 files changed

+5
-88
lines changed

libc/src/__support/FPUtil/sqrt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_SQRT_H
1111

1212
#include "src/__support/macros/properties/architectures.h"
13+
#include "src/__support/macros/properties/cpu_features.h"
1314

14-
#if defined(LIBC_TARGET_ARCH_IS_X86_64)
15+
#if defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2)
1516
#include "x86_64/sqrt.h"
1617
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
1718
#include "aarch64/sqrt.h"

libc/src/__support/FPUtil/x86_64/PolyEval.h

Lines changed: 0 additions & 85 deletions
This file was deleted.

libc/src/__support/FPUtil/x86_64/sqrt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/properties/architectures.h"
14+
#include "src/__support/macros/properties/cpu_features.h"
1415

15-
#if !defined(LIBC_TARGET_ARCH_IS_X86)
16-
#error "Invalid include"
16+
#if !(defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2))
17+
#error "sqrtss / sqrtsd need SSE2"
1718
#endif
1819

1920
#include "src/__support/FPUtil/generic/sqrt.h"

0 commit comments

Comments
 (0)