[llvm] cbf2a6c - [RISCV] Add test which shows alignment of constant pools and the functions which followed

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 21 15:02:58 PDT 2023


Author: Philip Reames
Date: 2023-07-21T15:02:43-07:00
New Revision: cbf2a6ce197e8176c01316fe25400aae0b7390c4

URL: https://github.com/llvm/llvm-project/commit/cbf2a6ce197e8176c01316fe25400aae0b7390c4
DIFF: https://github.com/llvm/llvm-project/commit/cbf2a6ce197e8176c01316fe25400aae0b7390c4.diff

LOG: [RISCV] Add test which shows alignment of constant pools and the functions which followed

Added: 
    llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll
new file mode 100644
index 00000000000000..a01d878f53c800
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll
@@ -0,0 +1,46 @@
+; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s
+
+define void @constantpool_v16xi8(ptr %x) {
+; CHECK: .section	.rodata.cst16,"aM", at progbits,16
+; CHECK: .p2align	4, 0x0
+; CHECK: .byte
+; CHECK: .globl	constantpool_v16xi8
+; CHECK: .p2align	2
+  store <16 x i8> <i8 0, i8 1, i8 3, i8 3, i8 4, i8 5, i8 15, i8 7, i8 27, i8 9, i8 10, i8 11, i8 12, i8 13, i8 12, i8 15>, ptr %x
+  ret void
+}
+
+define void @constantpool_v4xi32(ptr %x) {
+; CHECK: .section	.rodata.cst16,"aM", at progbits,16
+; CHECK: .p2align	4, 0x0
+; CHECK: .word
+; CHECK: .globl	constantpool_v4xi32
+; CHECK: .p2align	2
+  store <4 x i32> <i32 -27, i32 255, i32 3, i32 63>, ptr %x
+  ret void
+}
+
+; Note that to exercise the 64 bit alignment case, we need four elements
+; as all of the two element small constant cases get optimized to some
+; other sequence
+define void @constantpool_v4xi64(ptr %x) {
+; CHECK: .section	.rodata.cst32,"aM", at progbits,32
+; CHECK: .p2align	5, 0x0
+; CHECK: .quad
+; CHECK: .globl	constantpool_v4xi64
+; CHECK: .p2align	2
+  store <4 x i64> <i64 -27, i64 255, i64 3, i64 63>, ptr %x
+  ret void
+}
+
+define void @constantpool_i64(ptr %x) {
+; CHECK: .section	.sdata,"aw", at progbits
+; CHECK: .p2align	3
+; CHECK: .quad	58373358938439
+; CHECK: .globl	constantpool_i64
+; CHECK: .p2align	2
+  store i64 58373358938439, ptr %x
+  ret void
+}
+
+


        


More information about the llvm-commits mailing list