[AMDGPU] Add commute for some VOP3 inst (#121326)
[llvm-project.git] / compiler-rt / test / xray / TestCases / Posix / arg1-arg0-logging.cpp
blob402b0850a8e5f549be392c013ff12f4bbace1bff
1 // Allow having both the no-arg and arg1 logging implementation live together,
2 // and be called in the correct cases.
3 //
4 // RUN: rm -f arg0-arg1-logging-*
5 // RUN: %clangxx_xray -std=c++11 %s -o %t
6 // RUN: env XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=arg0-arg1-logging-" %run %t
8 // REQUIRES: target={{(aarch64|x86_64)-.*}}
10 #include "xray/xray_interface.h"
11 #include <cassert>
12 #include <cstdio>
14 using namespace std;
16 bool arg0loggercalled = false;
17 void arg0logger(int32_t, XRayEntryType) { arg0loggercalled = true; }
19 [[clang::xray_always_instrument]] void arg0fn() { printf("hello, arg0!\n"); }
21 bool arg1loggercalled = false;
22 void arg1logger(int32_t, XRayEntryType, uint64_t) { arg1loggercalled = true; }
24 [[ clang::xray_always_instrument, clang::xray_log_args(1) ]] void
25 arg1fn(uint64_t arg1) {
26 printf("hello, arg1!\n");
29 int main(int argc, char *argv[]) {
30 __xray_set_handler(arg0logger);
31 __xray_set_handler_arg1(arg1logger);
32 arg0fn();
33 arg1fn(0xcafef00d);
34 __xray_remove_handler_arg1();
35 __xray_remove_handler();
36 assert(arg0loggercalled && arg1loggercalled);