From b85fb9eca6a6a7612ae6451995f9908bfbbba72f Mon Sep 17 00:00:00 2001 From: swcompiler Date: Mon, 25 Nov 2024 16:56:12 +0800 Subject: [PATCH 14/16] Sw64 Port: add lex builtin support in libcpp --- libcpp/lex.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcpp/lex.cc b/libcpp/lex.cc index fb1dfabb7..bc2541ef9 100644 --- a/libcpp/lex.cc +++ b/libcpp/lex.cc @@ -168,6 +168,8 @@ acc_char_cmp (word_type val, word_type c) /* We can get exact results using a compare-bytes instruction. Get (val == c) via (0 >= (val ^ c)). */ return __builtin_alpha_cmpbge (0, val ^ c); +#elif defined(__GNUC__) && defined(__sw_64__) + return __builtin_sw_64_cmpbge (0, val ^ c); #else word_type magic = 0x7efefefeU; if (sizeof(word_type) == 8) @@ -186,7 +188,8 @@ static inline int acc_char_index (word_type cmp ATTRIBUTE_UNUSED, word_type val ATTRIBUTE_UNUSED) { -#if defined(__GNUC__) && defined(__alpha__) && !WORDS_BIGENDIAN +#if defined(__GNUC__) && (defined(__alpha__) || defined(__sw_64__)) \ + && !WORDS_BIGENDIAN /* The cmpbge instruction sets *bits* of the result corresponding to matches in the bytes with no false positives. */ return __builtin_ctzl (cmp); -- 2.25.1