Skip to content
Snippets Groups Projects
Commit e68a3154 authored by Roger Sayle's avatar Roger Sayle
Browse files

[Committed] Use QImode for offsets in zero_extract/sign_extract in i386.md

As suggested by Uros, this patch changes the ZERO_EXTRACTs and SIGN_EXTRACTs
in i386.md to consistently use QImode for bit offsets (i.e. third and fourth
operands), matching the use of QImode for bit counts in shifts and rotates.

This iteration also corrects the "ne:QI" vs "eq:QI" mistake in the previous
version, which was responsible for PR 110787 and PR 110790 and so was
rapidly reverted last weekend.  New test cases have been added to check
the correct behaviour.

2023-07-29  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR target/110790
	* config/i386/i386.md (extv<mode>): Use QImode for offsets.
	(extzv<mode>): Likewise.
	(insv<mode>): Likewise.
	(*testqi_ext_3): Likewise.
	(*btr<mode>_2): Likewise.
	(define_split): Likewise.
	(*btsq_imm): Likewise.
	(*btrq_imm): Likewise.
	(*btcq_imm): Likewise.
	(define_peephole2 x3): Likewise.
	(*bt<mode>): Likewise
	(*bt<mode>_mask): New define_insn_and_split.
	(*jcc_bt<mode>): Use QImode for offsets.
	(*jcc_bt<mode>_1): Delete obsolete pattern.
	(*jcc_bt<mode>_mask): Use QImode offsets.
	(*jcc_bt<mode>_mask_1): Likewise.
	(define_split): Likewise.
	(*bt<mode>_setcqi): Likewise.
	(*bt<mode>_setncqi): Likewise.
	(*bt<mode>_setnc<mode>): Likewise.
	(*bt<mode>_setncqi_2): Likewise.
	(*bt<mode>_setc<mode>_mask): New define_insn_and_split.
	(bmi2_bzhi_<mode>3): Use QImode offsets.
	(*bmi2_bzhi_<mode>3): Likewise.
	(*bmi2_bzhi_<mode>3_1): Likewise.
	(*bmi2_bzhi_<mode>3_1_ccz): Likewise.
	(@tbm_bextri_<mode>): Likewise.

gcc/testsuite/ChangeLog
	PR target/110790
	* gcc.target/i386/pr110790-1.c: New test case.
	* gcc.target/i386/pr110790-2.c: Likewise.
parent 8b9e559f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment