1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright IBM Corp. 2020
5 * This test attempts to cause a FP denormal exception on POWER8 CPUs. Unfortunately
6 * if the denormal handler is not configured or working properly, this can cause a bad
7 * crash in kernel mode when the kernel tries to save FP registers when the process
16 static int test_denormal_fpu(void)
23 /* try to induce lfs <denormal> ; stfd */
25 m32 = 0x00715fcf; /* random denormal */
26 memcpy((float *)&f, &m32, sizeof(f));
28 memcpy(&m64, (double *)&d, sizeof(d));
30 FAIL_IF((long)(m64 != 0x380c57f3c0000000)); /* renormalised value */
35 int main(int argc, char *argv[])
37 return test_harness(test_denormal_fpu, "fpu_denormal");