mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
_dl_tlsdesc_dynamic should also preserve AMX registers which are caller-saved. Add X86_XSTATE_TILECFG_ID and X86_XSTATE_TILEDATA_ID to x86-64 TLSDESC_CALL_STATE_SAVE_MASK. Compute the AMX state size and save it in xsave_state_full_size which is only used by _dl_tlsdesc_dynamic_xsave and _dl_tlsdesc_dynamic_xsavec. This fixes the AMX part of BZ #31372. Tested on AMX processor. AMX test is enabled only for compilers with the fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114098 GCC 14 and GCC 11/12/13 branches have the bug fix. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
63 lines
1.8 KiB
C
63 lines
1.8 KiB
C
/* Test TLSDESC relocation with AMX.
|
|
Copyright (C) 2024 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <x86intrin.h>
|
|
#include <support/check.h>
|
|
|
|
#define MAX_ROWS 16
|
|
#define MAX_COLS 64
|
|
#define MAX 1024
|
|
#define STRIDE 64
|
|
|
|
typedef struct __tile_config
|
|
{
|
|
uint8_t palette_id;
|
|
uint8_t start_row;
|
|
uint8_t reserved_0[14];
|
|
uint16_t colsb[16];
|
|
uint8_t rows[16];
|
|
} __tilecfg __attribute__ ((aligned (64)));
|
|
|
|
/* Initialize int8_t buffer */
|
|
static inline void
|
|
init_buffer (int8_t *buf, int8_t value)
|
|
{
|
|
int rows, colsb, i, j;
|
|
rows = MAX_ROWS;
|
|
colsb = MAX_COLS;
|
|
|
|
for (i = 0; i < rows; i++)
|
|
for (j = 0; j < colsb; j++)
|
|
buf[i * colsb + j] = value;
|
|
}
|
|
|
|
#define BEFORE_TLSDESC_CALL() \
|
|
int8_t src[MAX]; \
|
|
int8_t res[MAX]; \
|
|
/* Initialize src with data */ \
|
|
init_buffer (src, 2); \
|
|
/* Load tile rows from memory. */ \
|
|
_tile_loadd (2, src, STRIDE);
|
|
|
|
#define AFTER_TLSDESC_CALL() \
|
|
/* Store the tile data to memory. */ \
|
|
_tile_stored (2, res, STRIDE); \
|
|
_tile_release (); \
|
|
TEST_VERIFY_EXIT (memcmp (src, res, sizeof (res)) == 0);
|