return_ll1.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Area: ffi_call
  2. Purpose: Check if long long are passed in the corresponding regs on ppc.
  3. Limitations: none.
  4. PR: 20104.
  5. Originator: <andreast@gcc.gnu.org> 20050222 */
  6. /* { dg-do run } */
  7. /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */
  8. #include "ffitest.h"
  9. static long long return_ll(int ll0, long long ll1, int ll2)
  10. {
  11. return ll0 + ll1 + ll2;
  12. }
  13. int main (void)
  14. {
  15. ffi_cif cif;
  16. ffi_type *args[MAX_ARGS];
  17. void *values[MAX_ARGS];
  18. long long rlonglong;
  19. long long ll1;
  20. unsigned ll0, ll2;
  21. args[0] = &ffi_type_sint;
  22. args[1] = &ffi_type_sint64;
  23. args[2] = &ffi_type_sint;
  24. values[0] = &ll0;
  25. values[1] = &ll1;
  26. values[2] = &ll2;
  27. /* Initialize the cif */
  28. CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
  29. &ffi_type_sint64, args) == FFI_OK);
  30. ll0 = 11111111;
  31. ll1 = 11111111111000LL;
  32. ll2 = 11111111;
  33. ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
  34. printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2);
  35. /* { dg-output "res: 11111133333222, 11111133333222" } */
  36. exit(0);
  37. }