RE: [PATCH] RISC-V: Refactor the or pattern to switch cases

2023-05-14 Thread Li, Pan2 via Gcc-patches
Committed, thank you kito! Pan -Original Message- From: Kito Cheng Sent: Sunday, May 14, 2023 4:45 PM To: Li, Pan2 Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Wang, Yanzhang Subject: Re: [PATCH] RISC-V: Refactor the or pattern to switch cases OK

Re: [PATCH] RISC-V: Refactor the or pattern to switch cases

2023-05-14 Thread Kito Cheng via Gcc-patches
OK, thanks :) On Sun, May 14, 2023 at 4:22 PM Pan Li via Gcc-patches wrote: > > From: Pan Li > > This patch refactor the pattern A or B or C or D, to the switch case for > easy add/remove new types, as well as human reading friendly. > > Before this patch: > return A || B || C || D; > > After th

[PATCH] RISC-V: Refactor the or pattern to switch cases

2023-05-14 Thread Pan Li via Gcc-patches
From: Pan Li This patch refactor the pattern A or B or C or D, to the switch case for easy add/remove new types, as well as human reading friendly. Before this patch: return A || B || C || D; After this patch: switch (type) { case A: case B: case C: case D: return true;