From: Julian Zhu Date: Tue, 8 Jul 2025 10:09:36 +0000 (+0800) Subject: RISC-V: Add Zbb orn and its pseudo instruction opcode to rv64gc in riscv.pm X-Git-Tag: openssl-3.6.0-alpha1~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a68746099c7e81e455f70349be5ce69c9b644ad;p=thirdparty%2Fopenssl.git RISC-V: Add Zbb orn and its pseudo instruction opcode to rv64gc in riscv.pm Signed-off-by: Julian Zhu Reviewed-by: Paul Yang Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/27990) --- diff --git a/crypto/perlasm/riscv.pm b/crypto/perlasm/riscv.pm index 69a47c5bcfe..bac41fb453b 100644 --- a/crypto/perlasm/riscv.pm +++ b/crypto/perlasm/riscv.pm @@ -289,6 +289,15 @@ ___ return $code; } +sub orn_rv64i { + my ($rd, $rs1, $rs2) = @_; + my $code=<<___; + not $rd, $rs2 + or $rd, $rd, $rs1 +___ + return $code; +} + # Scalar crypto instructions sub aes64ds { @@ -388,6 +397,16 @@ sub clmulh { return ".word ".($template | ($rs2 << 20) | ($rs1 << 15) | ($rd << 7)); } +sub orn { + # Encoding for orn rd, rs1, rs2 + # 0100000 _ rs2 _ rs1 _110_ rd _0110011 + my $template = 0b0100000_00000_00000_110_00000_0110011; + my $rd = read_reg shift; + my $rs1 = read_reg shift; + my $rs2 = read_reg shift; + return ".word ".($template | ($rs2 << 20) | ($rs1 << 15) | ($rd << 7)); +} + sub rev8 { # Encoding for rev8 rd, rs instruction on RV64 # XXXXXXXXXXXXX_ rs _XXX_ rd _XXXXXXX