1f08c3bdfSopenharmony_citypedef unsigned short u16; 2f08c3bdfSopenharmony_citypedef unsigned int u32; 3f08c3bdfSopenharmony_citypedef unsigned long long u64; 4f08c3bdfSopenharmony_ci 5f08c3bdfSopenharmony_cistatic u16 swap16v(u16 a) 6f08c3bdfSopenharmony_ci{ 7f08c3bdfSopenharmony_ci return __builtin_bswap16(a); 8f08c3bdfSopenharmony_ci} 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_cistatic u32 swap32v(u64 a) 11f08c3bdfSopenharmony_ci{ 12f08c3bdfSopenharmony_ci return __builtin_bswap32(a); 13f08c3bdfSopenharmony_ci} 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_cistatic u64 swap64v(u32 a) 16f08c3bdfSopenharmony_ci{ 17f08c3bdfSopenharmony_ci return __builtin_bswap64(a); 18f08c3bdfSopenharmony_ci} 19f08c3bdfSopenharmony_ci 20f08c3bdfSopenharmony_ci/* 21f08c3bdfSopenharmony_ci * check-name: builtin-bswap 22f08c3bdfSopenharmony_ci * check-command: test-linearize $file 23f08c3bdfSopenharmony_ci * check-description: Check that the right builtin function is called, and 24f08c3bdfSopenharmony_ci * that the args are correctly promoted or truncated. 25f08c3bdfSopenharmony_ci * 26f08c3bdfSopenharmony_ci * check-output-ignore 27f08c3bdfSopenharmony_ci * check-output-contains:call.16 .* __builtin_bswap16 28f08c3bdfSopenharmony_ci * check-output-contains:trunc.32 .* (64) %arg1 29f08c3bdfSopenharmony_ci * check-output-contains:call.32 .* __builtin_bswap32 30f08c3bdfSopenharmony_ci * check-output-contains:zext.64 .* (32) %arg1 31f08c3bdfSopenharmony_ci * check-output-contains:call.64 .* __builtin_bswap64 32f08c3bdfSopenharmony_ci */ 33