From 530b1d688761db46b33d26864d3a0684cc82e0f9 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Wed, 27 Jan 2021 13:22:36 +0800 Subject: [PATCH] Fix ICE for [PR target/98833]. And replace __builtin_ia32_pcmpeqb128 with operator == in libcpp. gcc/ChangeLog: PR target/98833 * config/i386/sse.md (sse2_gt3): Drop !TARGET_XOP in condition. (*sse2_eq3): Ditto. gcc/testsuite/ChangeLog: PR target/98833 * gcc.target/i386/pr98833.c: New test. libcpp/ PR target/98833 * lex.c (search_line_sse2): Replace builtins with == operator. --- gcc/config/i386/sse.md | 4 ++-- gcc/testsuite/gcc.target/i386/pr98833.c | 9 +++++++++ libcpp/lex.c | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr98833.c diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 9683a991fb2..369a00d8f51 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -13041,7 +13041,7 @@ (eq:VI124_128 (match_operand:VI124_128 1 "vector_operand" "%0,x") (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))] - "TARGET_SSE2 && !TARGET_XOP + "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))" "@ pcmpeq\t{%2, %0|%0, %2} @@ -13143,7 +13143,7 @@ (gt:VI124_128 (match_operand:VI124_128 1 "register_operand" "0,x") (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))] - "TARGET_SSE2 && !TARGET_XOP" + "TARGET_SSE2" "@ pcmpgt\t{%2, %0|%0, %2} vpcmpgt\t{%2, %1, %0|%0, %1, %2}" diff --git a/gcc/testsuite/gcc.target/i386/pr98833.c b/gcc/testsuite/gcc.target/i386/pr98833.c new file mode 100644 index 00000000000..086c37cad55 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98833.c @@ -0,0 +1,9 @@ +/* PR target/98833 */ +/* { dg-do compile } */ +/* { dg-options "-mavx512vl -O2 -mxop" } */ + +int __attribute__((__vector_size__(4 * sizeof(int)))) * f5_p; +int __attribute__((__vector_size__(4 * sizeof(int)))) * f6_p; + +void f5() { *f5_p = 0 == *f5_p; } +void f6() { *f5_p = *f6_p > *f5_p; } diff --git a/libcpp/lex.c b/libcpp/lex.c index cba0b6c1e1b..6af140459ad 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -391,10 +391,10 @@ search_line_sse2 (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) mask = -1; start: - t = __builtin_ia32_pcmpeqb128(data, repl_nl); - t |= __builtin_ia32_pcmpeqb128(data, repl_cr); - t |= __builtin_ia32_pcmpeqb128(data, repl_bs); - t |= __builtin_ia32_pcmpeqb128(data, repl_qm); + t = data == repl_nl; + t |= data == repl_cr; + t |= data == repl_bs; + t |= data == repl_qm; found = __builtin_ia32_pmovmskb128 (t); found &= mask; } -- 2.30.2