xref: /llvm-project/clang/test/CodeGen/X86/amx_tile.c (revision b43c97c2ddfe9e922bb044de01312adb81591a48)
1 // RUN: %clang_cc1 %s -flax-vector-conversions=none -ffreestanding -triple=x86_64-unknown-unknown  -target-feature +amx-tile  \
2 // RUN: -emit-llvm -o - -Werror -pedantic | FileCheck %s --check-prefixes=CHECK
3 
4 #include <immintrin.h>
5 
6 char buf[1024];
7 #define STRIDE 32
8 
9 void test_tile_loadd(short row, short col) {
10   //CHECK-LABEL: @test_tile_loadd
11   //CHECK-DAG: call x86_amx @llvm.x86.tileloadd64.internal
12   //CHECK-DAG: call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx {{%.*}})
13   __tile1024i a = {row, col};
14   __tile_loadd(&a, buf, STRIDE);
15 }
16 
17 void test_tile_stream_loadd(short row, short col) {
18   //CHECK-LABEL: @test_tile_stream_loadd
19   //CHECK-DAG: call x86_amx @llvm.x86.tileloaddt164.internal
20   //CHECK-DAG: call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx {{%.*}})
21   __tile1024i a = {row, col};
22   __tile_stream_loadd(&a, buf, STRIDE);
23 }
24 
25 void test_tile_stored(__tile1024i c) {
26   //CHECK-LABEL: @test_tile_stored
27   //CHECK-DAG: call x86_amx @llvm.x86.cast.vector.to.tile.v256i32(<256 x i32> {{%.*}})
28   //CHECK-DAG: call void @llvm.x86.tilestored64.internal
29   __tile_stored(buf, STRIDE, c);
30 }
31 
32 void test_tile_zero(__tile1024i c) {
33   //CHECK-LABEL: @test_tile_zero
34   //CHECK-DAG: call x86_amx @llvm.x86.tilezero.internal
35   //CHECK-DAG: call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx {{%.*}})
36   __tile_zero(&c);
37 }
38