x265: Fix riscv64 build with clang

The riscv64 ADDPTR assembler macro invokes "stride_shift" while the
macro is defined as STRIDE_SHIFT. GNU as matches macro names
case-insensitively, but the LLVM integrated assembler does not, so
building sad-a.S with high bit depth (the default 10bit PACKAGECONFIG)
fails with clang:

  error: unrecognized instruction mnemonic
  stride_shift a6, a7, t5, t5, 1, 1

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-10-19 20:33:06 -07:00
1 parent 2553982f24
commit 8d9b05049e
2 files changed
+38

No files matched your search

@@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Mon, 19 Oct 2026 19:50:54 -0700
Subject: [PATCH] riscv64: Fix case of STRIDE_SHIFT macro invocation
The ADDPTR macro invokes "stride_shift", but the macro is defined as
STRIDE_SHIFT. GNU as matches macro names case-insensitively, so this
works with GCC, but the LLVM integrated assembler is case-sensitive
and fails to build the high bit depth SAD functions with clang:
<instantiation>:1:1: error: unrecognized instruction mnemonic
stride_shift a6, a7, t5, t5, 1, 1
^
common/riscv64/sad-a.S:666:1: note: while in macro instantiation
SAD_FUNC_COMMON 24, 32, 1 , 2
Use the name the macro is defined with.
Upstream-Status: Pending
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
source/common/riscv64/asm.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/common/riscv64/asm.S b/source/common/riscv64/asm.S
index 39953af..09eab48 100644
--- a/source/common/riscv64/asm.S
+++ b/source/common/riscv64/asm.S
@@ -332,7 +332,7 @@ ELF .size \name, . - \name
.endm
.macro ADDPTR t0, t1, s0, s1, stride0, stride1, shift0, shift1
- stride_shift \t0, \t1, \stride0, \stride1, \shift0, \shift1
+ STRIDE_SHIFT \t0, \t1, \stride0, \stride1, \shift0, \shift1
add \s0, \s0, \t0
add \s1, \s1, \t1
.endm
@@ -12,6 +12,7 @@ SRC_URI = " \
git://github.com/Multicorewareinc/x265.git;protocol=https;branch=master;tag=${PV} \
file://0001-fix-dynamicHDR10-undefined-uint8_t.patch;patchdir=.. \
file://0002-x265-fix-build-with-cmake-4.patch;patchdir=.. \
file://0003-riscv64-Fix-case-of-STRIDE_SHIFT-macro-invocation.patch;patchdir=.. \
"
SRCREV = "e9b88125dc21393b3fd8d68e98083bdfb89778a8"
S = "${UNPACKDIR}/x265-${PV}/source"