xref: /third_party/ltp/tools/sparse/sparse-src/validation/expand/builtin_fpclassify.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/expand/
1f08c3bdfSopenharmony_cienum { FP_NAN, FP_INF, FP_NOR, FP_SUB, FP_ZERO };
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_ci#define	classify(X) __builtin_fpclassify(FP_NAN,FP_INF,FP_NOR,FP_SUB,FP_ZERO,X)
4f08c3bdfSopenharmony_ci
5f08c3bdfSopenharmony_ciint test(void)
6f08c3bdfSopenharmony_ci{
7f08c3bdfSopenharmony_ci	if (classify(__builtin_nan("0")) != FP_NAN)
8f08c3bdfSopenharmony_ci		return 0;
9f08c3bdfSopenharmony_ci	if (classify(__builtin_inf("0")) != FP_INF)
10f08c3bdfSopenharmony_ci		return 0;
11f08c3bdfSopenharmony_ci	if (classify(1.0) != FP_NOR)
12f08c3bdfSopenharmony_ci		return 0;
13f08c3bdfSopenharmony_ci	if (classify(0.0) != FP_ZERO)
14f08c3bdfSopenharmony_ci		return 0;
15f08c3bdfSopenharmony_ci
16f08c3bdfSopenharmony_ci	return 1;
17f08c3bdfSopenharmony_ci}
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_ci/*
20f08c3bdfSopenharmony_ci * check-name: builtin_fpclassify
21f08c3bdfSopenharmony_ci * check-command: test-linearize -Wno-decl $file
22f08c3bdfSopenharmony_ci * check-known-to-fail
23f08c3bdfSopenharmony_ci *
24f08c3bdfSopenharmony_ci * check-output-ignore
25f08c3bdfSopenharmony_ci * check-output-contains: ret\\..*\\$1
26f08c3bdfSopenharmony_ci */
27

Indexes created Thu Nov 07 10:32:03 CST 2024