builtin-bswap-variable.c 782 B

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