Skip to content

Commit

Permalink
Add test case for vector types
Browse files Browse the repository at this point in the history
Vector types are not supported and test is not run.
  • Loading branch information
eunovm committed Feb 14, 2019
1 parent 5cfe2ad commit 7950381
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/input/c-backend/vector-type.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Source code is based on https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html. */
typedef int v4si __attribute__ ((vector_size (16)));

void func(void)
{
v4si a, b, c, d, e, g = {1,2,3,4}, h = {3,2,1,4}, i;

c = a + b;

d = e + 1; /* d = e + {1,1,1,1}; */
d = 2 * e; /* d = {2,2,2,2} * e; */

i = g > h; /* The result would be {0, 0,-1, 0} */
i = g == h; /* The result would be {0,-1, 0,-1} */
}
5 changes: 5 additions & 0 deletions tests/test_c_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@ def test_fix_trunc_expr(self):
self.cif.run(cif_input='input/c-backend/fix-trunc-expr.c', aspect='aspect/empty.aspect', cif_output='work/fix-trunc-expr.c')
self.compare(output='work/fix-trunc-expr.c', expected='output/c-backend/fix-trunc-expr.c')

# Let's support vector types one day later.
def _test_vector_type(self):
self.cif.run(cif_input='input/c-backend/vector-type.c', aspect='aspect/empty.aspect', cif_output='work/vector-type.c')
self.compare(output='work/vector-type.c', expected='output/c-backend/vector-type.c')

if __name__ == '__main__':
unittest.main()

0 comments on commit 7950381

Please sign in to comment.