File: vector_int.c

package info (click to toggle)
chibicc 1.0.23.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,832 kB
  • sloc: ansic: 62,911; sh: 275; makefile: 92
file content (26 lines) | stat: -rw-r--r-- 592 bytes parent folder | download
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
#include "test.h"

typedef int int4 __attribute__((vector_size(16)));

int4 add_int4(int4 a, int4 b) {
    return a + b;
}

int main() {
    int4 a = {1, 2, 3, 4};
    int4 b = {10, 20, 30, 40};
    int4 c;
    c = add_int4(a, b);
    int4 d = add_int4(a, c);
    printf("c = %d %d %d %d\n", c[0], c[1], c[2], c[3]);
    ASSERT(11, c[0]);
    ASSERT(22, c[1]);
    ASSERT(33, c[2]);
    ASSERT(44, c[3]);
    printf("d = %d %d %d %d\n", d[0], d[1], d[2], d[3]);
    ASSERT(12, d[0]);
    ASSERT(24, d[1]);
    ASSERT(36, d[2]);
    ASSERT(48, d[3]);
    return 0;
}