1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2020 Valve Corporation
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci *
23bf215546Sopenharmony_ci */
24bf215546Sopenharmony_ci#include "helpers.h"
25bf215546Sopenharmony_ci#include <stdio.h>
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ciusing namespace aco;
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ciBEGIN_TEST_TODO(todo)
30bf215546Sopenharmony_ci   //!test!
31bf215546Sopenharmony_ci   fprintf(output, "woops!\n");
32bf215546Sopenharmony_ciEND_TEST
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ciBEGIN_TEST_FAIL(expect_fail)
35bf215546Sopenharmony_ci   //!test!
36bf215546Sopenharmony_ci   fprintf(output, "woops!\n");
37bf215546Sopenharmony_ciEND_TEST
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ciBEGIN_TEST(simple.1)
40bf215546Sopenharmony_ci   //! s_buffer_load_dwordx2 @s64(a)
41bf215546Sopenharmony_ci   fprintf(output, "s_buffer_load_dwordx2 s[6:7]\n");
42bf215546Sopenharmony_ci   //! s_add_u32 s#b0, s#a, 1
43bf215546Sopenharmony_ci   //! s_addc_u32 s#b1, s#a1, 0
44bf215546Sopenharmony_ci   //; success = int(b0) == 8
45bf215546Sopenharmony_ci   fprintf(output, "s_add_u32 s8, s6, 1\n");
46bf215546Sopenharmony_ci   fprintf(output, "s_addc_u32 s9, s7, 0\n");
47bf215546Sopenharmony_ci   //! s_buffer_store_dwordx2 @s64(b)
48bf215546Sopenharmony_ci   fprintf(output, "s_buffer_store_dwordx2 s[8:9]\n");
49bf215546Sopenharmony_ciEND_TEST
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_ciBEGIN_TEST(simple.2)
52bf215546Sopenharmony_ci   //~gfx[67]! test gfx67
53bf215546Sopenharmony_ci   //~gfx8! test gfx8
54bf215546Sopenharmony_ci   //~gfx9! test gfx9
55bf215546Sopenharmony_ci   //! test all
56bf215546Sopenharmony_ci   for (int cls = GFX6; cls <= GFX7; cls++) {
57bf215546Sopenharmony_ci      if (!set_variant((enum amd_gfx_level)cls))
58bf215546Sopenharmony_ci         continue;
59bf215546Sopenharmony_ci      fprintf(output, "test gfx67\n");
60bf215546Sopenharmony_ci      fprintf(output, "test all\n");
61bf215546Sopenharmony_ci   }
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ci   if (set_variant("gfx8")) {
64bf215546Sopenharmony_ci      fprintf(output, "test gfx8\n");
65bf215546Sopenharmony_ci      fprintf(output, "test all\n");
66bf215546Sopenharmony_ci   }
67bf215546Sopenharmony_ci
68bf215546Sopenharmony_ci   if (set_variant("gfx9")) {
69bf215546Sopenharmony_ci      fprintf(output, "test gfx9\n");
70bf215546Sopenharmony_ci      fprintf(output, "test all\n");
71bf215546Sopenharmony_ci   }
72bf215546Sopenharmony_ciEND_TEST
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_ciBEGIN_TEST(simple.3)
75bf215546Sopenharmony_ci   //; funcs['test'] = lambda a: a
76bf215546Sopenharmony_ci   //! @test(s_buffer_load_dwordx2) @s64(a)
77bf215546Sopenharmony_ci   fprintf(output, "s_buffer_load_dwordx2 s[6:7]\n");
78bf215546Sopenharmony_ciEND_TEST
79