i386: Fix up __builtin_ia32_b{extr{,i}_u{32,64},zhi_{s,d}i} folding [PR116287]
The GENERIC folding of these builtins have cases where it folds to a constant regardless of the value of the first operand. If so, we need to use omit_one_operand to avoid throwing away side-effects in the first operand if any. The cases which verify the first argument is INTEGER_CST don't need that, INTEGER_CST doesn't have side-effects. 2024-08-09 Jakub Jelinek <jakub@redhat.com> PR target/116287 * config/i386/i386.cc (ix86_fold_builtin) <case IX86_BUILTIN_BEXTR32>: When folding into zero without checking whether first argument is constant, use omit_one_operand. (ix86_fold_builtin) <case IX86_BUILTIN_BZHI32>: Likewise. * gcc.target/i386/bmi-pr116287.c: New test. * gcc.target/i386/bmi2-pr116287.c: New test. * gcc.target/i386/tbm-pr116287.c: New test.
Showing
- gcc/config/i386/i386.cc 8 additions, 4 deletionsgcc/config/i386/i386.cc
- gcc/testsuite/gcc.target/i386/bmi-pr116287.c 28 additions, 0 deletionsgcc/testsuite/gcc.target/i386/bmi-pr116287.c
- gcc/testsuite/gcc.target/i386/bmi2-pr116287.c 24 additions, 0 deletionsgcc/testsuite/gcc.target/i386/bmi2-pr116287.c
- gcc/testsuite/gcc.target/i386/tbm-pr116287.c 29 additions, 0 deletionsgcc/testsuite/gcc.target/i386/tbm-pr116287.c
gcc/testsuite/gcc.target/i386/bmi-pr116287.c
0 → 100644
gcc/testsuite/gcc.target/i386/tbm-pr116287.c
0 → 100644
Please register or sign in to comment