Debian Codegraph @

gcc/testsuite/jit.dg/test-bfloat16.c

raw
1 /* { dg-do compile { target x86_64-*-* } } */
2
3 #include <stdlib.h>
4 #include <stdio.h>
5
6 #include "libgccjit.h"
7
8 /* We don't want set_options() in harness.h to set -O3 so our little local
9 is optimized away. */
10 #define TEST_ESCHEWS_SET_OPTIONS
11 static void set_options (gcc_jit_context *ctxt, const char *argv0)
12 {
13 }
14
15 #define TEST_COMPILING_TO_FILE
16 #define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_ASSEMBLER
17 #define OUTPUT_FILENAME "output-of-test-bfloat16.c.s"
18 #include "harness.h"
19
20 void
21 create_code (gcc_jit_context *ctxt, void *user_data)
22 {
23 gcc_jit_type *bf16_type =
24 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_BFLOAT16);
25
26 gcc_jit_lvalue *foo =
27 gcc_jit_context_new_global (
28 ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, bf16_type, "foo");
29
30 gcc_jit_rvalue *value =
31 gcc_jit_context_new_rvalue_from_double (ctxt, bf16_type, 3.1415);
32 gcc_jit_global_set_initializer_rvalue (foo, value);
33 }
34
35 /* { dg-final { jit-verify-output-file-was-created "" } } */
36 /* { dg-final { jit-verify-assembler-output ".value 16457" } } */
37 /* { dg-final { jit-verify-assembler-output ".size foo, 2" } } */