[clang] [llvm] [RISCV][P-ext] Support Packed Load (PR #223313)

Kito Cheng via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 18:59:36 PDT 2026


================
@@ -312,6 +335,11 @@ typedef uint32_t uint32x2_t __attribute__((__vector_size__(8)));
     return __builtin_bit_cast(rty, __x);                                       \
   }
 
+#define __packed_load(name, ty, elt_ty, ua_ty)                                 \
+  static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(elt_ty *__p) {        \
+    return *(ua_ty *)__p;                                                      \
+  }
----------------
kito-cheng wrote:

Could you declare those type within the function to prevent expose those type on global name space, e.g.

```suggestion
  static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(elt_ty *__p) {        \
    typedef elt_ty ua_ty __attribute__(( __aligned__(1)));                     \
    return *(ua_ty *)__p;                                                      \
  }
```

https://github.com/llvm/llvm-project/pull/223313


More information about the cfe-commits mailing list