Compiler projects using llvm
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target

// Check CUID generated by hash.
// The same CUID is generated for the same file with the same options.

// RUN: %clang -### -x hip -target x86_64-unknown-linux-gnu \
// RUN:   --offload-arch=gfx906 -c -nogpulib -fuse-cuid=hash \
// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1

// RUN: %clang -### -x hip -target x86_64-unknown-linux-gnu \
// RUN:   --offload-arch=gfx906 -c -nogpulib -fuse-cuid=hash \
// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1

// RUN: FileCheck %s -check-prefixes=SAME -input-file %t.out

// Check CUID generated by hash.
// Different CUID's are generated for the same file with different options.

// RUN: %clang -### -x hip -target x86_64-unknown-linux-gnu -DX=1 \
// RUN:   --offload-arch=gfx906 -c -nogpulib -fuse-cuid=hash \
// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1

// RUN: %clang -### -x hip -target x86_64-unknown-linux-gnu -DX=2 \
// RUN:   --offload-arch=gfx906 -c -nogpulib -fuse-cuid=hash \
// RUN:   %S/Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1

// RUN: FileCheck %s -check-prefixes=DIFF -input-file %t.out

// SAME: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID:[0-9a-f]+]]"
// SAME: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID]]"

// DIFF: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID:[0-9a-f]+]]"
// DIFF-NOT: "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID]]"