| 1 | /* |
| 2 | * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | #include <string.h> |
| 9 | #include <hexagon_types.h> |
| 10 | #include <hvx_hexagon_protos.h> |
| 11 | |
| 12 | int err; |
| 13 | #include "hvx_misc.h" |
| 14 | |
| 15 | static void test_disabled(void) |
| 16 | { |
| 17 | memset(output, 0xAA, sizeof(output)); |
| 18 | memset(expect, 0, sizeof(expect)); |
| 19 | asm volatile("r0 = #0xff\n" |
| 20 | "v0 = vsplat(r0)\n" |
| 21 | "r1 = #0x1\n" |
| 22 | "v1 = vsplat(r1)\n" |
| 23 | "v2 = vsplat(r1)\n" |
| 24 | "v0.sf = vadd(v1.sf, v2.sf)\n" |
| 25 | "vmem(%0 + #0) = v0\n" |
| 26 | : |
| 27 | : "r"(output) |
| 28 | : "r0", "r1", "v0", "v1", "v2", "memory"); |
| 29 | check_output_w(__LINE__, 1); |
| 30 | } |
| 31 | |
| 32 | static void test_disabled_with_new(void) |
| 33 | { |
| 34 | memset(output, 0xAA, sizeof(output)); |
| 35 | memset(expect, 0, sizeof(expect)); |
| 36 | asm volatile("r0 = #0xff\n" |
| 37 | "v0 = vsplat(r0)\n" |
| 38 | "r1 = #0x1\n" |
| 39 | "v1 = vsplat(r1)\n" |
| 40 | "v2 = vsplat(r1)\n" |
| 41 | "{\n" |
| 42 | " v0.sf = vadd(v1.sf, v2.sf)\n" |
| 43 | " vmem(%0 + #0) = v0.new\n" |
| 44 | "}\n" |
| 45 | : |
| 46 | : "r"(output) |
| 47 | : "r0", "r1", "v0", "v1", "v2", "memory"); |
| 48 | check_output_w(__LINE__, 1); |
| 49 | } |
| 50 | |
| 51 | int main(void) |
| 52 | { |
| 53 | test_disabled(); |
| 54 | test_disabled_with_new(); |
| 55 | puts(err ? "FAIL" : "PASS"); |
| 56 | return err ? 1 : 0; |
| 57 | } |