File: memory-alignment.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (20 lines) | stat: -rw-r--r-- 991 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// This test checks that __memory_alignment is correctly set based on the user
// provided command line option --force-alignment
// __memory_alignment value is defined in the core.isph file without the initialization
// when ISPC compiles stdlib bitcode files during ISPC build. Later, this value
// is initialized with the value provided by the user via macro definition in
// ISPC_MEMORY_ALIGNMENT_VAL defined in module.cpp file (where preprocessor is
// initialized). This value is then used in the new functions to allocate memory.

// RUN: %{ispc} %s --target=host --force-alignment=42 2>&1 --debug-phase=2:2 -o t.o | FileCheck %s --check-prefix=CHECK-CONSTANT
// RUN: %{ispc} %s --target=host --target-os=linux --force-alignment=1024 2>&1 --emit-llvm-text -o - | FileCheck %s

// REQUIRES: LINUX_ENABLED

// CHECK-CONSTANT: @__memory_alignment = constant i32 42

// CHECK: call {{.*}} @posix_memalign({{.*}}, {{.*}} 1024, {{.*}}

uniform int* foo() {
    return uniform new int[10];
}