Commit e5839ca
committed
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 <[email protected]>
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.
(cherry picked from commit 6e7088d)1 parent e5a9c15 commit e5839ca
File tree
4 files changed
+89
-4
lines changed- gcc
- config/i386
- testsuite/gcc.target/i386
4 files changed
+89
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18054 | 18054 | | |
18055 | 18055 | | |
18056 | 18056 | | |
| 18057 | + | |
18057 | 18058 | | |
18058 | 18059 | | |
18059 | | - | |
| 18060 | + | |
| 18061 | + | |
18060 | 18062 | | |
18061 | 18063 | | |
18062 | 18064 | | |
| |||
18065 | 18067 | | |
18066 | 18068 | | |
18067 | 18069 | | |
18068 | | - | |
| 18070 | + | |
18069 | 18071 | | |
18070 | 18072 | | |
18071 | 18073 | | |
| |||
18075 | 18077 | | |
18076 | 18078 | | |
18077 | 18079 | | |
| 18080 | + | |
18078 | 18081 | | |
18079 | 18082 | | |
18080 | 18083 | | |
18081 | | - | |
| 18084 | + | |
| 18085 | + | |
18082 | 18086 | | |
18083 | 18087 | | |
18084 | 18088 | | |
18085 | 18089 | | |
18086 | | - | |
| 18090 | + | |
18087 | 18091 | | |
18088 | 18092 | | |
18089 | 18093 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments