aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2022-11-28 09:59:47 +0800
committerliuhongt <hongtao.liu@intel.com>2022-12-01 11:36:14 +0800
commitac30c91a1002ae4049a4773d07d5da41e7bd3138 (patch)
treede168d3f902a0c065e355ac5b185f40846fe0511 /gcc
parente73b8e2a42a17ae62507eeb0e4aa10682ed195ea (diff)
downloadgcc-ac30c91a1002ae4049a4773d07d5da41e7bd3138.zip
gcc-ac30c91a1002ae4049a4773d07d5da41e7bd3138.tar.gz
gcc-ac30c91a1002ae4049a4773d07d5da41e7bd3138.tar.bz2
Fix unrecognizable insn due to illegal immediate_operand (const_int 255) of QImode.
For __builtin_ia32_vec_set_v16qi (a, -1, 2) with !flag_signed_char. it's transformed to __builtin_ia32_vec_set_v16qi (_4, 255, 2) in the gimple, and expanded to (const_int 255) in the rtl. But for immediate_operand, it expects (const_int 255) to be signed extended to (const_int -1). The mismatch caused an unrecognizable insn error. The patch converts (const_int 255) to (const_int -1) in the backend expander. gcc/ChangeLog: PR target/107863 * config/i386/i386-expand.c (ix86_expand_vec_set_builtin): Convert op1 to target mode whenever mode mismatch. gcc/testsuite/ChangeLog: * gcc.target/i386/pr107863.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/i386-expand.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr107863.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 6075532..15ea243 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10955,7 +10955,7 @@ ix86_expand_vec_set_builtin (tree exp)
op1 = expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL);
elt = get_element_number (TREE_TYPE (arg0), arg2);
- if (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode)
+ if (GET_MODE (op1) != mode1)
op1 = convert_modes (mode1, GET_MODE (op1), op1, true);
op0 = force_reg (tmode, op0);
diff --git a/gcc/testsuite/gcc.target/i386/pr107863.c b/gcc/testsuite/gcc.target/i386/pr107863.c
new file mode 100644
index 0000000..99fd85d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107863.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -O" } */
+
+typedef char v16qi __attribute__((vector_size(16)));
+
+v16qi foo(v16qi a){
+ return __builtin_ia32_vec_set_v16qi (a, -1, 2);
+}