RE: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-06 Thread Li, Pan2
I see, thanks a lot. Pan -Original Message- From: Jeff Law Sent: Monday, July 7, 2025 10:38 AM To: Li, Pan2 ; Robin Dapp ; gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@gmail.com; Chen, Ken ; Liu, Hongtao Subject: Re: [PATCH v3 3/4] RISC-V: Implement unsigned scalar

Re: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-06 Thread Jeff Law
On 7/4/25 10:54 PM, Li, Pan2 wrote: What you do want to watch out for is constants Here I want the max value of unsigned scalar based on mode, it could be UINT8_MAX, UINT16_MAX, UINT32_MAX and UINT64_MAX. Understood, but within the compiler HOST_WIDE_INT is how we tend to want to work on

RE: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-04 Thread Li, Pan2
aw Sent: Saturday, July 5, 2025 9:46 AM To: Robin Dapp ; Li, Pan2 ; gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@gmail.com; Chen, Ken ; Liu, Hongtao Subject: Re: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t On 7/4/25 1:18 PM, Robin Dapp wrote: > T

Re: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-04 Thread Jeff Law
On 7/4/25 1:18 PM, Robin Dapp wrote: This generally looks OK to me (including the tests). +  HOST_WIDE_INT max = ((uint64_t)1 << bitsize) - 1; Wouldn't a uint64_t type for max be clearer?  I guess the worst that can happen is compiling on a 32-bit host for a 64-bit target and get bitsize

Re: [PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-04 Thread Robin Dapp
This generally looks OK to me (including the tests). + HOST_WIDE_INT max = ((uint64_t)1 << bitsize) - 1; Wouldn't a uint64_t type for max be clearer? I guess the worst that can happen is compiling on a 32-bit host for a 64-bit target and get bitsize == 32 here. Do we even support this? If

[PATCH v3 3/4] RISC-V: Implement unsigned scalar SAT_MUL from uint128_t

2025-07-01 Thread pan2 . li
From: Pan Li This patch would like to implement the SAT_MUL scalar unsigned from uint128_t, aka: NT __attribute__((noinline)) sat_u_mul_##NT##_fmt_1 (NT a, NT b) { uint128_t x = (uint128_t)a * (uint128_t)b; NT max = -1; if (x > (uint128_t)(max)) return max; else