From: Florian Weimer on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1144#note_598979089

Current GCC compiles this code to use the `msrkc` instruction:

```c
#include <stdlib.h>

int
f (int a, int b)
{
  int result;
  if (__builtin_mul_overflow (a, b, &result))
    abort ();
  return result;
}

int
main (int argc, char **argv)
{
  return f (atoi (argv[1]), atoi (argv[2]));
}
```

Maybe not exactly common, but also not super-obscure.  I think the kernel uses
`__builtin_mul_overflow` in some places.  `s390.md` in GCC has patterns for
the other instructions, too, search for `TARGET_Z14`.

The sort-of working aspect was the reason why I added the run-time check to
glibc.  I was worried that without it, some z14 binaries will appear to work,
but crash in obscure ways for some operations because GCC happened to emit one
of the new instructions.
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to