File: vector_abi_x86.d

package info (click to toggle)
ldc 1%3A1.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,248 kB
  • sloc: cpp: 61,598; ansic: 14,545; sh: 1,014; makefile: 972; asm: 510; objc: 135; exp: 48; python: 12
file content (39 lines) | stat: -rw-r--r-- 899 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Makes sure an optimized trivial function taking and returning a vector
// takes and returns it directly in XMM0, with no memory indirections.

// REQUIRES: host_X86

// RUN: %ldc -O -output-s -m32 -of=%t_32.s %s -mattr=+sse2
// RUN: FileCheck --check-prefix=COMMON %s < %t_32.s

// RUN: %ldc -O -output-s -m64 -of=%t_64.s %s
// RUN: FileCheck --check-prefix=COMMON --check-prefix=X64 %s < %t_64.s

import core.simd;

// COMMON: _D14vector_abi_x863foo
int4 foo(int4 param)
{
    // COMMON-NOT: mov
    // COMMON: paddd
    // COMMON-SAME: %xmm0
    return param + 3;
    // COMMON-NOT: mov
    // COMMON: ret
}

version (X86_64)
{
    struct Int4 { int4 v; }

    // X64: _D14vector_abi_x863barFSQw4Int4ZQj
    Int4 bar(Int4 param)
    {
        // X64-NOT: mov
        // X64: paddd
        // X64-SAME: %xmm0
        return Int4(param.v + 3);
        // X64-NOT: mov
        // X64: ret
    }
}