Skip to content
Snippets Groups Projects
Commit a1751681 authored by Tsukasa OI's avatar Tsukasa OI
Browse files

RISC-V: Make bit manipulation value / round number and shift amount types for builtins unsigned

For bit manipulation operations, input(s) and the manipulated output are
better to be unsigned like other target-independent builtins like
__builtin_bswap32 and __builtin_popcount.

Although this is not completely compatible as before (as the type changes),
most code will run normally, even without warnings (with -Wall -Wextra).

To make consistent to the LLVM commit 599421ae36c3 ("[RISCV] Use unsigned
instead of signed types for Zk* and Zb* builtins."), round numbers and
shift amount on the scalar crypto instructions are also changed
to unsigned.

gcc/ChangeLog:

	* config/riscv/riscv-builtins.cc (RISCV_ATYPE_UQI): New for
	uint8_t.  (RISCV_ATYPE_UHI): New for uint16_t.
	(RISCV_ATYPE_QI, RISCV_ATYPE_HI, RISCV_ATYPE_SI, RISCV_ATYPE_DI):
	Removed as no longer used.
	(RISCV_ATYPE_UDI): New for uint64_t.
	* config/riscv/riscv-cmo.def: Make types unsigned for not working
	"zicbop_cbo_prefetchi" and working bit manipulation clmul builtin
	argument/return types.
	* config/riscv/riscv-ftypes.def: Make bit manipulation, round
	number and shift amount types unsigned.
	* config/riscv/riscv-scalar-crypto.def: Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zbc32.c: Make signed type to unsigned.
	* gcc.target/riscv/zbc64.c: Ditto.
	* gcc.target/riscv/zbkb32.c: Ditto.
	* gcc.target/riscv/zbkb64.c: Ditto.
	* gcc.target/riscv/zbkc32.c: Ditto.
	* gcc.target/riscv/zbkc64.c: Ditto.
	* gcc.target/riscv/zbkx32.c: Ditto.
	* gcc.target/riscv/zbkx64.c: Ditto.
	* gcc.target/riscv/zknd32.c: Ditto.
	* gcc.target/riscv/zknd64.c: Ditto.
	* gcc.target/riscv/zkne32.c: Ditto.
	* gcc.target/riscv/zkne64.c: Ditto.
	* gcc.target/riscv/zknh-sha256.c: Ditto.
	* gcc.target/riscv/zknh-sha512-32.c: Ditto.
	* gcc.target/riscv/zknh-sha512-64.c: Ditto.
	* gcc.target/riscv/zksed32.c: Ditto.
	* gcc.target/riscv/zksed64.c: Ditto.
	* gcc.target/riscv/zksh32.c: Ditto.
	* gcc.target/riscv/zksh64.c: Ditto.
parent 23224f06
No related branches found
No related tags found
Loading
Showing
with 127 additions and 128 deletions
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