22 changes: 11 additions & 11 deletions clang/test/Driver/hip-device-compile.hip
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,55 @@
// Output unbundled bitcode.
// RUN: %clang -c -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.bc -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,BC,NBUN %s

// Output bundled bitcode.
// RUN: %clang -c -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.bc -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,BCBUN %s

// Output unbundled LLVM IR.
// RUN: %clang -c -S -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.ll -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LL,NBUN %s

// Output bundled LLVM IR.
// RUN: %clang -c -S -emit-llvm --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.ll -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LLBUN %s

// Output unbundled assembly.
// RUN: %clang -c -S --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.s -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,ASM,NBUN %s

// Output relocatable.
// RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 -fhip-emit-relocatable \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,NBUN,RELOC %s

// Output bundled assembly.
// RUN: %clang -c -S --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.s -x hip --cuda-gpu-arch=gfx900 --no-gpu-bundle-output \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu --gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,ASMBUN %s
Expand Down Expand Up @@ -96,31 +96,31 @@
// Output bundled code objects.
// RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-BUN %s

// Output unbundled code objects.
// RUN: %clang -c --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu --no-gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-UBUN %s

// Output bundled code objects.
// RUN: %clang --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-BUN %s

// Output unbundled code objects.
// RUN: %clang --cuda-device-only -### --target=x86_64-linux-gnu \
// RUN: --rocm-path=%S/Inputs/rocm -o a.o -x hip --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib=lib1.bc \
// RUN: --no-offload-new-driver --hip-device-lib=lib1.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu --no-gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=OBJ,OBJ-UBUN %s
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/hip-link-bc-to-bc.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx906 --hip-link \
// RUN: -nogpulib -nogpuinc -emit-llvm -fgpu-rdc --cuda-device-only \
// RUN: %t/bundle1.bc %t/bundle2.bc \
// RUN: --no-offload-new-driver %t/bundle1.bc %t/bundle2.bc \
// RUN: 2>&1 | FileCheck -check-prefix=BITCODE %s

// BITCODE: "{{.*}}clang-offload-bundler" "-type=bc" "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx906" "-input={{.*}}bundle1.bc" "-output=[[B1HOST:.*\.bc]]" "-output=[[B1DEV1:.*\.bc]]" "-unbundle" "-allow-missing-bundles"
Expand All @@ -24,7 +24,7 @@

// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx906 --hip-link \
// RUN: -nogpulib -nogpuinc -emit-llvm -fgpu-rdc --cuda-device-only \
// RUN: %t/bundle.bc -L%t -lhipbundle \
// RUN: --no-offload-new-driver %t/bundle.bc -L%t -lhipbundle \
// RUN: 2>&1 | FileCheck -check-prefix=ARCHIVE %s

// ARCHIVE: "{{.*}}clang-offload-bundler" "-type=bc" "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx906" "-input={{.*}}bundle.bc" "-output=[[HOST:.*\.bc]]" "-output=[[DEV1:.*\.bc]]" "-unbundle" "-allow-missing-bundles"
Expand Down
22 changes: 11 additions & 11 deletions clang/test/Driver/hip-link-bundle-archive.hip
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,64 @@
// RUN: touch %t/dummy.bc
// RUN: llvm-ar cr %t/libhipBundled.a %t/dummy.bc
// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -lhipBundled \
// RUN: 2>&1 | FileCheck -check-prefixes=GNU,GNU1,GNU-L %s

// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 -nogpuinc \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -l:libhipBundled.a \
// RUN: 2>&1 | FileCheck -check-prefixes=GNU,GNU1,GNU-LA %s

// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc %t/libhipBundled.a \
// RUN: 2>&1 | FileCheck -check-prefixes=GNU,GNU1,GNU-A %s

// RUN: llvm-ar cr %t/libhipBundled.a.5.2 %t/dummy.bc
// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc %t/libhipBundled.a.5.2 \
// RUN: 2>&1 | FileCheck -check-prefixes=GNU,GNU2,GNU-A %s

// Check if a file is not an archive, it is not unbundled.

// RUN: touch %t/libNonArchive.a
// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -lNonArchive \
// RUN: 2>&1 | FileCheck -check-prefixes=NONARCHIVE %s
// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -l:libNonArchive.a \
// RUN: 2>&1 | FileCheck -check-prefixes=NONARCHIVE %s
// RUN: not %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t libNonArchive.a \
// RUN: 2>&1 | FileCheck -check-prefixes=NONARCHIVE %s

// Check if a file does not exist, it is not unbundled.

// RUN: not %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: --no-offload-new-driver --target=x86_64-unknown-linux-gnu \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc %t/NoneExist.a \
// RUN: 2>&1 | FileCheck -check-prefixes=NONE %s

// Check unbundling archive for MSVC.

// RUN: llvm-ar cr %t/hipBundled2.lib %t/dummy.bc
// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: --no-offload-new-driver --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -lhipBundled2 \
// RUN: 2>&1 | FileCheck -check-prefix=MSVC %s

// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: --no-offload-new-driver --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc -L%t -l:hipBundled2.lib \
// RUN: 2>&1 | FileCheck -check-prefix=MSVC %s

// RUN: %clang -### --offload-arch=gfx906 --offload-arch=gfx1030 \
// RUN: --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: --no-offload-new-driver --target=x86_64-pc-windows-msvc -fuse-ld= \
// RUN: -nogpuinc -nogpulib %s -fgpu-rdc %t/hipBundled2.lib \
// RUN: 2>&1 | FileCheck -check-prefix=MSVC %s

Expand Down
8 changes: 4 additions & 4 deletions clang/test/Driver/hip-link-save-temps.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// RUN: touch %t/obj2.o
// RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \
// RUN: --hip-link -o executable -fgpu-rdc --cuda-gpu-arch=gfx900 \
// RUN: --offload-arch=gfx906 %t/obj1.o %t/obj2.o 2>&1 | \
// RUN: --no-offload-new-driver --offload-arch=gfx906 %t/obj1.o %t/obj2.o 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,OUT %s

// -fgpu-rdc link without output
// RUN: touch %t/obj1.o
// RUN: touch %t/obj2.o
// RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \
// RUN: --hip-link -fgpu-rdc --cuda-gpu-arch=gfx900 \
// RUN: --no-offload-new-driver --hip-link -fgpu-rdc --cuda-gpu-arch=gfx900 \
// RUN: --offload-arch=gfx906 %t/obj1.o %t/obj2.o 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,NOUT %s

Expand All @@ -23,7 +23,7 @@
// RUN: touch %t/obj2.o
// RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \
// RUN: --hip-link -o libTest.a -fgpu-rdc --cuda-gpu-arch=gfx900 \
// RUN: --emit-static-lib \
// RUN: --no-offload-new-driver --emit-static-lib \
// RUN: --offload-arch=gfx906 %t/obj1.o %t/obj2.o 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,SLO %s

Expand All @@ -32,7 +32,7 @@
// RUN: touch %t/obj2.o
// RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \
// RUN: --hip-link -fgpu-rdc --cuda-gpu-arch=gfx900 \
// RUN: --emit-static-lib \
// RUN: --no-offload-new-driver --emit-static-lib \
// RUN: --offload-arch=gfx906 %t/obj1.o %t/obj2.o 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,SLNO %s

Expand Down
3 changes: 1 addition & 2 deletions clang/test/Driver/hip-link-shared-library.hip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: touch %t.o
// RUN: %clang --hip-link -ccc-print-bindings --target=x86_64-linux-gnu \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %t.o %S/Inputs/in.so \
// RUN: -fgpu-rdc 2>&1 | FileCheck %s
// RUN: --no-offload-new-driver -fgpu-rdc 2>&1 | FileCheck %s

// CHECK: # "x86_64-unknown-linux-gnu" - "offload bundler", inputs: ["[[IN:.*o]]"], outputs: ["[[HOSTOBJ:.*o]]", "{{.*o}}", "{{.*o}}"]
// CHECK: # "amdgcn-amd-amdhsa" - "offload bundler", inputs: ["[[IN]]"], outputs: ["{{.*o}}", "[[DOBJ1:.*o]]", "[[DOBJ2:.*o]]"]
Expand All @@ -12,4 +12,3 @@
// CHECK: # "amdgcn-amd-amdhsa" - "AMDGCN::Linker", inputs: ["[[IMG1]]", "[[IMG2]]"], output: "[[FATBINOBJ:.*o]]"
// CHECK-NOT: offload bundler
// CHECK: # "x86_64-unknown-linux-gnu" - "GNU::Linker", inputs: ["[[HOSTOBJ]]", "{{.*}}/Inputs/in.so", "[[FATBINOBJ]]"], output: "a.out"

6 changes: 3 additions & 3 deletions clang/test/Driver/hip-link-static-library.hip
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// RUN: touch %t.o
// RUN: %clang --hip-link -ccc-print-bindings --target=x86_64-linux-gnu \
// RUN: --emit-static-lib \
// RUN: --no-offload-new-driver --emit-static-lib \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 -fgpu-rdc %t.o\
// RUN: 2>&1 | FileCheck %s

Expand All @@ -18,15 +18,15 @@
// CHECK: # "x86_64-unknown-linux-gnu" - "GNU::StaticLibTool", inputs: ["[[HOSTOBJ]]", "[[FATBINOBJ]]"], output: "a.out"

// RUN: %clang --hip-link -ccc-print-bindings --target=x86_64-linux-gnu \
// RUN: --emit-static-lib \
// RUN: --no-offload-new-driver --emit-static-lib \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %t.o\
// RUN: 2>&1 | FileCheck -check-prefix=NORDC %s

// NORDC-NOT: offload bundler
// NORDC: # "x86_64-unknown-linux-gnu" - "GNU::StaticLibTool", inputs: ["{{.*o}}"], output: "a.out"

// RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
// RUN: --emit-static-lib -lgcc \
// RUN: --no-offload-new-driver --emit-static-lib -lgcc \
// RUN: -Wl,--enable-new-dtags -Wl,--rpath=/opt \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 -fgpu-rdc %t.o\
// RUN: 2>&1 | FileCheck -check-prefix=NOFLAG %s
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/hip-offload-compress-zlib.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: rm -rf %t.bc
// RUN: %clang -c -v --target=x86_64-linux-gnu \
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -fgpu-rdc -nogpuinc -nogpulib \
// RUN: --no-offload-new-driver -fgpu-rdc -nogpuinc -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: --offload-compress --offload-device-only --gpu-bundle-output \
// RUN: -o %t.bc \
Expand All @@ -22,7 +22,7 @@

// RUN: %clang --hip-link -### -v --target=x86_64-linux-gnu \
// RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -fgpu-rdc -nogpulib \
// RUN: --no-offload-new-driver -fgpu-rdc -nogpulib \
// RUN: %t.bc --offload-device-only \
// RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s

Expand All @@ -35,7 +35,7 @@

// RUN: %clang -c -### -v --target=x86_64-linux-gnu \
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -nogpuinc -nogpulib \
// RUN: --no-offload-new-driver -nogpuinc -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: --offload-compress \
// RUN: 2>&1 | FileCheck -check-prefix=CO %s
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/hip-offload-compress-zstd.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: rm -rf %t.bc
// RUN: %clang -c -v --target=x86_64-linux-gnu \
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -fgpu-rdc -nogpuinc -nogpulib \
// RUN: --no-offload-new-driver -fgpu-rdc -nogpuinc -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: --offload-compress --offload-device-only --gpu-bundle-output \
// RUN: -o %t.bc \
Expand All @@ -22,7 +22,7 @@

// RUN: %clang --hip-link -### -v --target=x86_64-linux-gnu \
// RUN: --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -fgpu-rdc -nogpulib \
// RUN: --no-offload-new-driver -fgpu-rdc -nogpulib \
// RUN: %t.bc --offload-device-only \
// RUN: 2>&1 | FileCheck -check-prefix=UNBUNDLE %s

Expand All @@ -35,7 +35,7 @@

// RUN: %clang -c -### -v --target=x86_64-linux-gnu \
// RUN: -x hip --offload-arch=gfx1100 --offload-arch=gfx1101 \
// RUN: -nogpuinc -nogpulib \
// RUN: --no-offload-new-driver -nogpuinc -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: --offload-compress \
// RUN: 2>&1 | FileCheck -check-prefix=CO %s
Expand Down
26 changes: 13 additions & 13 deletions clang/test/Driver/hip-output-file-name.hip
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// REQUIRES: amdgpu-registered-target

// Output bundled code objects for combined compilation.
// RUN: %clang -### -c --target=x86_64-linux-gnu -fgpu-rdc \
// RUN: %clang -### -c --target=x86_64-linux-gnu -fgpu-rdc --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck %s

Expand All @@ -13,42 +13,42 @@
// is used to bundle the final output.

// Output bundled PPE for one GPU for mixed compliation.
// RUN: %clang -### -E --target=x86_64-linux-gnu \
// RUN: %clang -### -E --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=DASH %s

// Output unbundled PPE for one GPU for device only compilation.
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 %s \
// RUN: --no-offload-new-driver -nogpulib -nogpuinc --offload-arch=gfx803 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=CLANG-DASH %s

// Output bundled PPE for two GPUs for mixed compilation.
// RUN: %clang -### -E --target=x86_64-linux-gnu \
// RUN: %clang -### -E --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=DASH %s

// Output bundled PPE for two GPUs for mixed compilation with -save-temps.
// RUN: %clang -### -E -save-temps --target=x86_64-linux-gnu \
// RUN: %clang -### -E -save-temps --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=DASH %s

// Output unbundled PPE for two GPUs for device only compilation.
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=CLANG-DASH %s

// Output bundled PPE for two GPUs for device only compilation with --gpu-bundle-output.
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s --gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=DASH %s

// Output unbundled PPE for two GPUs for device only compilation with --no-gpu-bundle-output.
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E --offload-device-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s --no-gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=CLANG-DASH %s

// Output unbundled PPE for host only compilation.
// RUN: %clang -### -E --offload-host-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E --offload-host-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=CLANG-DASH %s

Expand All @@ -60,22 +60,22 @@
// Check -E with -o.

// Output bundled PPE for two GPUs for mixed compilation.
// RUN: %clang -### -E -o test.cui --target=x86_64-linux-gnu \
// RUN: %clang -### -E -o test.cui --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=OUT %s

// Output bundled PPE for two GPUs for mixed compilation.
// RUN: %clang -### -E -o test.cui -save-temps --target=x86_64-linux-gnu \
// RUN: %clang -### -E -o test.cui -save-temps --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=OUT %s

// Output bundled PPE for two GPUs for device only compilation with --gpu-bundle-output.
// RUN: %clang -### -E -o test.cui --offload-device-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E -o test.cui --offload-device-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 --gpu-bundle-output %s \
// RUN: 2>&1 | FileCheck -check-prefixes=OUT %s

// Output unbundled PPE for two GPUs for device only compilation.
// RUN: %clang -### -E -o test.cui --offload-host-only --target=x86_64-linux-gnu \
// RUN: %clang -### -E -o test.cui --offload-host-only --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -nogpulib -nogpuinc --offload-arch=gfx803 --offload-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck -check-prefixes=CLANG-OUT %s

Expand Down
14 changes: 7 additions & 7 deletions clang/test/Driver/hip-partial-link.hip
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// REQUIRES: x86-registered-target, amdgpu-registered-target, lld, system-linux

// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu \
// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nostdinc -nogpuinc -nohipwrapperinc \
// RUN: -nogpulib -fgpu-rdc -I%S/Inputs %s -o %t.1.o

// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu -DLIB \
// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu -DLIB --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nostdinc -nogpuinc -nohipwrapperinc \
// RUN: -nogpulib -fgpu-rdc -I%S/Inputs %s -o %t.2.o

// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu -DMAIN \
// RUN: %clang -x hip --target=x86_64-unknown-linux-gnu -DMAIN --no-offload-new-driver \
// RUN: --offload-arch=gfx906 -c -nostdinc -nogpuinc -nohipwrapperinc \
// RUN: -nogpulib -fgpu-rdc -I%S/Inputs %s -o %t.main.o

Expand All @@ -24,7 +24,7 @@

// Link %t.1.o and %t.2.o by -r and then link with %t.main.o

// RUN: %clang -v --target=x86_64-unknown-linux-gnu \
// RUN: %clang -v --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --hip-link -fgpu-rdc --offload-arch=gfx906 \
// RUN: -r -fuse-ld=lld -nostdlib %t.1.o %t.2.o -o %t.lib.o \
// RUN: 2>&1 | FileCheck -check-prefix=LD-R %s
Expand All @@ -46,15 +46,15 @@
// OBJ: D __hip_gpubin_handle_[[ID1]]
// OBJ: D __hip_gpubin_handle_[[ID2]]

// RUN: %clang -v --target=x86_64-unknown-linux-gnu \
// RUN: %clang -v --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --hip-link -no-hip-rt -fgpu-rdc --offload-arch=gfx906 \
// RUN: -fuse-ld=lld -nostdlib -r %t.main.o %t.lib.o -o %t.final.o \
// RUN: 2>&1 | FileCheck -check-prefix=LINK-O %s
// LINK-O-NOT: Found undefined HIP {{.*}}symbol

// Generate a static lib with %t.1.o and %t.2.o then link with %t.main.o

// RUN: %clang -v --target=x86_64-unknown-linux-gnu \
// RUN: %clang -v --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --hip-link -fgpu-rdc --offload-arch=gfx906 \
// RUN: --emit-static-lib -fuse-ld=lld -nostdlib %t.1.o %t.2.o -o %t.a \
// RUN: 2>&1 | FileCheck -check-prefix=STATIC %s
Expand All @@ -68,7 +68,7 @@
// STATIC: "{{.*}}/llvm-mc" -triple x86_64-unknown-linux-gnu
// STATIC: "{{.*}}/llvm-ar"

// RUN: %clang -v --target=x86_64-unknown-linux-gnu \
// RUN: %clang -v --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
// RUN: --hip-link -no-hip-rt -fgpu-rdc --offload-arch=gfx906 \
// RUN: -fuse-ld=lld -nostdlib -r %t.main.o %t.a -o %t.final.o \
// RUN: 2>&1 | FileCheck -check-prefix=LINK-A %s
Expand Down
106 changes: 53 additions & 53 deletions clang/test/Driver/hip-phases.hip

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions clang/test/Driver/hip-rdc-device-only.hip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
Expand All @@ -11,7 +11,7 @@
// With `-emit-llvm`, the output should be the same as the aforementioned line
// as `-fgpu-rdc` in HIP implies `-emit-llvm`.

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
Expand All @@ -21,14 +21,14 @@
// With `-fno-hip-emit-relocatable`, the output should be the same as the aforementioned line
// as `-fgpu-rdc` in HIP implies `-fno-hip-emit-relocatable`.

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -c -fno-hip-emit-relocatable -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
Expand All @@ -38,7 +38,7 @@
// With `-emit-llvm`, the output should be the same as the aforementioned line
// as `-fgpu-rdc` in HIP implies `-emit-llvm`.

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
Expand All @@ -49,7 +49,7 @@
// output, there should 3 steps (preprocessor, compile, and backend) per source
// and per target, totally 12 steps.

// RUN: %clang -### -save-temps --target=x86_64-linux-gnu \
// RUN: %clang -### -save-temps --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
Expand All @@ -58,7 +58,7 @@

// Check output one file without bundling cause error.

// RUN: not %clang -### --target=x86_64-linux-gnu \
// RUN: not %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu -o %t.s --no-gpu-bundle-output \
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Driver/hip-target-id.hip
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
// RUN: -x hip \
// RUN: --offload-arch=gfx908:xnack+:sramecc+ \
// RUN: --offload-arch=gfx908:xnack+:sramecc- \
// RUN: --rocm-path=%S/Inputs/rocm \
// RUN: --no-offload-new-driver --rocm-path=%S/Inputs/rocm \
// RUN: %s 2>&1 | FileCheck %s

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip \
// RUN: --offload-arch=gfx908:xnack+:sramecc+ \
// RUN: --offload-arch=gfx908:xnack+:sramecc- \
// RUN: --rocm-path=%S/Inputs/rocm \
// RUN: -save-temps \
// RUN: --no-offload-new-driver -save-temps \
// RUN: %s 2>&1 | FileCheck --check-prefixes=CHECK,TMP %s

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip \
// RUN: --offload-arch=gfx908:xnack+:sramecc+ \
// RUN: --offload-arch=gfx908:xnack+:sramecc- \
// RUN: --rocm-path=%S/Inputs/rocm \
// RUN: -fgpu-rdc \
// RUN: --no-offload-new-driver -fgpu-rdc \
// RUN: %s 2>&1 | FileCheck --check-prefixes=CHECK %s

// CHECK: [[CLANG:"[^"]*clang[^"]*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
Expand Down Expand Up @@ -55,7 +55,7 @@
// RUN: --offload-arch=fiji \
// RUN: --offload-arch=gfx803 \
// RUN: --offload-arch=fiji \
// RUN: --rocm-path=%S/Inputs/rocm \
// RUN: --no-offload-new-driver --rocm-path=%S/Inputs/rocm \
// RUN: %s 2>&1 | FileCheck -check-prefix=FIJI %s
// FIJI: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx803"

Expand All @@ -66,6 +66,6 @@
// RUN: --offload-arch=gfx908:sramecc+ \
// RUN: --offload-arch=gfx908:sramecc- \
// RUN: --offload-arch=gfx906 \
// RUN: --rocm-path=%S/Inputs/rocm \
// RUN: --no-offload-new-driver --rocm-path=%S/Inputs/rocm \
// RUN: %s 2>&1 | FileCheck -check-prefix=MULTI %s
// MULTI: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx900:xnack+,hipv4-amdgcn-amd-amdhsa--gfx900:xnack-,hipv4-amdgcn-amd-amdhsa--gfx906,hipv4-amdgcn-amd-amdhsa--gfx908:sramecc+,hipv4-amdgcn-amd-amdhsa--gfx908:sramecc-"
24 changes: 12 additions & 12 deletions clang/test/Driver/hip-toolchain-features.hip
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib --no-offload-new-driver \
// RUN: -nogpuinc --offload-arch=gfx906:xnack+ --offload-arch=gfx900:xnack+ %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=XNACK
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib --no-offload-new-driver \
// RUN: -nogpuinc --offload-arch=gfx906:xnack- --offload-arch=gfx900:xnack- %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=NOXNACK

Expand All @@ -14,10 +14,10 @@
// NOXNACK: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-xnack"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx908:sramecc+ %s \
// RUN: -nogpuinc --offload-arch=gfx908:sramecc+ --no-offload-new-driver %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=SRAM
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx908:sramecc- %s \
// RUN: -nogpuinc --offload-arch=gfx908:sramecc- --no-offload-new-driver %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=NOSRAM

// SRAM: {{.*}}clang{{.*}}"-target-feature" "+sramecc"
Expand All @@ -26,10 +26,10 @@
// NOTSRAM: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-sramecc"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mcumode 2>&1 | FileCheck %s -check-prefix=CUMODE
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mno-cumode 2>&1 | FileCheck %s -check-prefix=NOTCUMODE

// CUMODE: {{.*}}clang{{.*}}"-target-feature" "+cumode"
Expand All @@ -38,20 +38,20 @@
// NOTCUMODE: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-cumode"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx908:xnack+:sramecc+ %s \
// RUN: -nogpuinc --offload-arch=gfx908:xnack+:sramecc+ --no-offload-new-driver %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=ALL3
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx908:xnack-:sramecc- %s \
// RUN: -nogpuinc --offload-arch=gfx908:xnack-:sramecc- --no-offload-new-driver %s \
// RUN: 2>&1 | FileCheck %s -check-prefix=NOALL3

// ALL3: {{.*}}clang{{.*}}"-target-feature" "+sramecc" "-target-feature" "+xnack"
// NOALL3: {{.*}}clang{{.*}}"-target-feature" "-sramecc" "-target-feature" "-xnack"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mtgsplit 2>&1 | FileCheck %s -check-prefix=TGSPLIT
// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mno-tgsplit 2>&1 | FileCheck %s -check-prefix=NOTTGSPLIT

// TGSPLIT: {{.*}}clang{{.*}}"-target-feature" "+tgsplit"
Expand All @@ -60,7 +60,7 @@
// NOTTGSPLIT: {{.*}}lld{{.*}} "-plugin-opt=-mattr=-tgsplit"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mcumode -mcumode -mno-cumode -mwavefrontsize64 -mcumode \
// RUN: -mwavefrontsize64 -mno-wavefrontsize64 2>&1 \
// RUN: | FileCheck %s -check-prefix=DUP
Expand All @@ -71,7 +71,7 @@
// DUP: {{.*}}lld{{.*}} "-plugin-opt=-mattr=+cumode"

// RUN: %clang -### --target=x86_64-linux-gnu -fgpu-rdc -nogpulib \
// RUN: -nogpuinc --offload-arch=gfx1010 %s \
// RUN: -nogpuinc --offload-arch=gfx1010 --no-offload-new-driver %s \
// RUN: -mno-wavefrontsize64 -mwavefrontsize64 2>&1 \
// RUN: | FileCheck %s -check-prefix=WAVE64
// WAVE64: {{.*}}clang{{.*}} "-target-feature" "+wavefrontsize64"
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Driver/hip-toolchain-rdc-separate.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: --no-offload-new-driver -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s
Expand Down Expand Up @@ -84,19 +84,19 @@

// RUN: touch %t/a.o %t/b.o
// RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %t/a.o %t/b.o \
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LINK-HOST-UNBUNDLE,LLD-TMP,LINK-BUNDLE,LINK-EMBED %s

// RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %t/a.o %t/b.o --cuda-device-only \
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-TMP,LINK-BUNDLE,LINK-NOEMBED %s

// RUN: %clang --hip-link -### --target=x86_64-linux-gnu \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: --no-offload-new-driver --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %t/a.o %t/b.o --cuda-device-only --no-gpu-bundle-output \
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-FIN,LINK-NOBUNDLE,LINK-NOEMBED %s
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/hip-toolchain-rdc-static-lib.hip
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: --emit-static-lib -nogpulib \
// RUN: --no-offload-new-driver --emit-static-lib -nogpulib \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/hip-toolchain-rdc.hip
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: -fhip-dump-offload-linker-script \
// RUN: --no-offload-new-driver -fhip-dump-offload-linker-script \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LNX %s
Expand All @@ -18,7 +18,7 @@
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: -fhip-dump-offload-linker-script \
// RUN: --no-offload-new-driver -fhip-dump-offload-linker-script \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,MSVC %s
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/hip-unbundle-preproc.hipi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// REQUIRES: amdgpu-registered-target

// RUN: %clang -### --target=x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx803 -nogpulib \
// RUN: --no-offload-new-driver --offload-arch=gfx803 -nogpulib \
// RUN: -x hip-cpp-output %s 2>&1 | FileCheck %s

// RUN: %clang -### --target=x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx803 -nogpulib \
// RUN: --no-offload-new-driver --offload-arch=gfx803 -nogpulib \
// RUN: %s 2>&1 | FileCheck %s

// CHECK: {{".*clang-offload-bundler.*"}} {{.*}}"-output=[[HOST_PP:.*hipi]]" "-output=[[DEV_PP:.*hipi]]" "-unbundle"
Expand All @@ -16,7 +16,7 @@
// CHECK: {{".*ld.*"}} {{.*}}"[[HOST_O]]"

// RUN: %clang -### --target=x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx803 -nogpulib -fgpu-rdc \
// RUN: --no-offload-new-driver --offload-arch=gfx803 -nogpulib -fgpu-rdc \
// RUN: %s 2>&1 | FileCheck -check-prefix=RDC %s

// RDC: {{".*clang-offload-bundler.*"}} {{.*}}"-output=[[HOST_PP:.*hipi]]" "-output=[[DEV_PP:.*hipi]]" "-unbundle"
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/hipspv-toolchain-rdc.hip
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// UNSUPPORTED: system-windows

// RUN: %clang -### -x hip -target x86_64-linux-gnu --offload=spirv64 \
// RUN: -fgpu-rdc --hip-path=%S/Inputs/hipspv -nohipwrapperinc \
// RUN: --no-offload-new-driver -fgpu-rdc --hip-path=%S/Inputs/hipspv -nohipwrapperinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/hipspv-toolchain.hip
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// UNSUPPORTED: system-windows

// RUN: %clang -### -target x86_64-linux-gnu --offload=spirv64 \
// RUN: --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \
// RUN: --no-offload-new-driver --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \
// RUN: 2>&1 | FileCheck %s

// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "spirv64"
Expand Down
22 changes: 11 additions & 11 deletions clang/test/Driver/lto.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// REQUIRES: nvptx-registered-target

// -flto causes a switch to llvm-bc object files.
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -nocudainc -nocudalib -ccc-print-phases -c %s -flto 2> %t
// RUN: %clangxx --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -ccc-print-phases -c %s -flto 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s
//
// CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir, (host-cuda)
// CHECK-COMPILE-ACTIONS-NOT: lto-bc
// CHECK-COMPILE-ACTIONS: 12: backend, {11}, lto-bc, (host-cuda)

// RUN: %clangxx --target=x86_64-unknown-linux-gnu -nocudainc -nocudalib -ccc-print-phases %s -flto 2> %t
// RUN: %clangxx --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -ccc-print-phases %s -flto 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s
//
// CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}lto.cu", cuda, (host-cuda)
Expand All @@ -29,44 +29,44 @@

// llvm-bc and llvm-ll outputs need to match regular suffixes
// (unfortunately).
// RUN: %clangxx %s --target=x86_64-unknown-linux-gnu -nocudainc -nocudalib -flto -save-temps --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda -### 2> %t
// RUN: %clangxx %s --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -flto -save-temps --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda -### 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-SUFFIXES < %t %s
//
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[CPP:.*lto-host.*\.cui]]" "-x" "cuda" "{{.*}}lto.cu"
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[BC:.*lto-host.*\.bc]]" {{.*}}[[CPP]]"
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[OBJ:.*lto-host.*\.o]]" {{.*}}[[BC]]"
// CHECK-COMPILELINK-SUFFIXES: "{{.*}}a.{{(out|exe)}}" {{.*}}[[OBJ]]"

// RUN: %clangxx --target=x86_64-unknown-linux-gnu %s -nocudainc -nocudalib -flto -S -### 2> %t
// RUN: %clangxx --target=x86_64-unknown-linux-gnu %s --no-offload-new-driver -nocudainc -nocudalib -flto -S -### 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILE-SUFFIXES < %t %s
//
// CHECK-COMPILE-SUFFIXES: "-o" "{{.*}}lto.s" "-x" "cuda" "{{.*}}lto.cu"

// RUN: not %clangxx --target=x86_64-unknown-linux-gnu -nocudainc -nocudalib %s -emit-llvm 2>&1 \
// RUN: not %clangxx --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib %s -emit-llvm 2>&1 \
// RUN: | FileCheck --check-prefix=LLVM-LINK %s
// LLVM-LINK: -emit-llvm cannot be used when linking

/// With ld.bfd or gold, link against LLVMgold.
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \
// RUN: -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
// RUN: --no-offload-new-driver -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \
// RUN: -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
// RUN: --no-offload-new-driver -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s
//
// LLVMGOLD: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"

/// lld does not need LLVMgold.
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \
// RUN: -fuse-ld=lld -flto=full -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
// RUN: --no-offload-new-driver -fuse-ld=lld -flto=full -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \
// RUN: -fuse-ld=gold -flto=full -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
// RUN: --no-offload-new-driver -fuse-ld=gold -flto=full -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s
//
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"

// -flto passes along an explicit debugger tuning argument.
// RUN: %clangxx -nocudainc -nocudalib \
// RUN: %clangxx -nocudainc -nocudalib --no-offload-new-driver \
// RUN: --target=x86_64-unknown-linux -### %s -flto -glldb --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2> %t
// RUN: FileCheck -check-prefix=CHECK-TUNING-LLDB < %t %s
// RUN: %clangxx -nocudainc -nocudalib \
// RUN: %clangxx -nocudainc -nocudalib --no-offload-new-driver \
// RUN: --target=x86_64-unknown-linux -### %s -flto -g --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2> %t
// RUN: FileCheck -check-prefix=CHECK-NO-TUNING < %t %s
//
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/thinlto.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// REQUIRES: nvptx-registered-target

// -flto=thin causes a switch to llvm-bc object files.
// RUN: %clangxx -ccc-print-phases -nocudainc -nocudalib -c %s -flto=thin 2> %t
// RUN: %clangxx -ccc-print-phases --no-offload-new-driver -nocudainc -nocudalib -c %s -flto=thin 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s
//
// CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir, (host-cuda)
// CHECK-COMPILE-ACTIONS-NOT: lto-bc
// CHECK-COMPILE-ACTIONS: 12: backend, {11}, lto-bc, (host-cuda)

// RUN: %clangxx -ccc-print-phases -nocudainc -nocudalib %s -flto=thin 2> %t
// RUN: %clangxx -ccc-print-phases --no-offload-new-driver -nocudainc -nocudalib %s -flto=thin 2> %t
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s
//
// CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}thinlto.cu", cuda, (host-cuda)
Expand Down
4 changes: 4 additions & 0 deletions clang/unittests/AST/MatchVerifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ MatchVerifier<NodeType>::match(const std::string &Code,
Args.push_back("-std=c++20");
FileName = "input.cc";
break;
case Lang_CXX23:
Args.push_back("-std=c++23");
FileName = "input.cc";
break;
case Lang_OpenCL:
Args.push_back("-cl-no-stdinc");
FileName = "input.cl";
Expand Down
7 changes: 5 additions & 2 deletions flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ class OMPFunctionFilteringPass
// Remove the callOp
callOp->erase();
}
if (!hasTargetRegion)
if (!hasTargetRegion) {
funcOp.erase();
else if (declareTargetOp)
return WalkResult::skip();
}
if (declareTargetOp)
declareTargetOp.setDeclareTarget(declareType,
omp::DeclareTargetCaptureClause::to);
}
return WalkResult::advance();
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions libc/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ add_header_library(
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
libc.src.__support.macros.optimization
libc.src.__support.macros.properties.types
)

add_header_library(
Expand All @@ -213,6 +214,7 @@ add_header_library(
UInt128.h
DEPENDS
.uint
libc.src.__support.macros.properties.types
)

add_header_library(
Expand Down
1 change: 1 addition & 0 deletions libc/src/__support/CPP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ add_header_library(
DEPENDS
.type_traits
libc.include.llvm-libc-macros.limits_macros
libc.src.__support.macros.properties.types
)

add_header_library(
Expand Down
5 changes: 3 additions & 2 deletions libc/src/__support/CPP/limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include "include/llvm-libc-macros/limits-macros.h" // CHAR_BIT
#include "src/__support/CPP/type_traits/is_integral.h"
#include "src/__support/CPP/type_traits/is_signed.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

namespace LIBC_NAMESPACE {
namespace cpp {
Expand Down Expand Up @@ -76,7 +77,7 @@ template <>
struct numeric_limits<unsigned char>
: public internal::integer_impl<unsigned char, 0, UCHAR_MAX> {};

#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
// On platform where UInt128 resolves to __uint128_t, this specialization
// provides the limits of UInt128.
template <>
Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/CPP/type_traits/is_integral.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/CPP/type_traits/remove_cv.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

namespace LIBC_NAMESPACE::cpp {

Expand All @@ -25,7 +26,7 @@ template <typename T> struct is_integral {
public:
LIBC_INLINE_VAR static constexpr bool value = __is_unqualified_any_of<
T,
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
__int128_t, __uint128_t,
#endif
char, signed char, unsigned char, short, unsigned short, int,
Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/CPP/type_traits/make_signed.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H

#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

namespace LIBC_NAMESPACE::cpp {

Expand All @@ -26,7 +27,7 @@ template <> struct make_signed<unsigned int> : type_identity<int> {};
template <> struct make_signed<unsigned long> : type_identity<long> {};
template <>
struct make_signed<unsigned long long> : type_identity<long long> {};
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
template <> struct make_signed<__int128_t> : type_identity<__int128_t> {};
template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {};
#endif
Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/CPP/type_traits/make_unsigned.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H

#include "src/__support/CPP/type_traits/type_identity.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

namespace LIBC_NAMESPACE::cpp {

Expand All @@ -31,7 +32,7 @@ template <>
struct make_unsigned<unsigned long> : type_identity<unsigned long> {};
template <>
struct make_unsigned<unsigned long long> : type_identity<unsigned long long> {};
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
template <> struct make_unsigned<__int128_t> : type_identity<__uint128_t> {};
template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {};
#endif
Expand Down
23 changes: 12 additions & 11 deletions libc/src/__support/UInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#include "src/__support/CPP/limits.h"
#include "src/__support/CPP/optional.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/math_extras.h" // SumCarry, DiffBorrow
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "src/__support/math_extras.h" // SumCarry, DiffBorrow
#include "src/__support/number_pair.h"

#include <stddef.h> // For size_t
Expand All @@ -30,9 +31,9 @@ template <typename T> struct half_width;
template <> struct half_width<uint64_t> : cpp::type_identity<uint32_t> {};
template <> struct half_width<uint32_t> : cpp::type_identity<uint16_t> {};
template <> struct half_width<uint16_t> : cpp::type_identity<uint8_t> {};
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
template <> struct half_width<__uint128_t> : cpp::type_identity<uint64_t> {};
#endif // __SIZEOF_INT128__
#endif // LIBC_TYPES_HAS_INT128

template <typename T> using half_width_t = typename half_width<T>::type;

Expand Down Expand Up @@ -69,7 +70,7 @@ LIBC_INLINE constexpr NumberPair<uint32_t> full_mul<uint32_t>(uint32_t a,
return result;
}

#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
template <>
LIBC_INLINE constexpr NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a,
uint64_t b) {
Expand All @@ -79,7 +80,7 @@ LIBC_INLINE constexpr NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a,
result.hi = uint64_t(prod >> 64);
return result;
}
#endif // __SIZEOF_INT128__
#endif // LIBC_TYPES_HAS_INT128

} // namespace internal

Expand Down Expand Up @@ -682,7 +683,7 @@ struct BigInt {
val[1] = uint32_t(tmp >> 32);
return;
}
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
if constexpr ((Bits == 128) && (WORD_SIZE == 64)) {
// Use builtin 128 bits if available;
if (s >= 128) {
Expand All @@ -696,7 +697,7 @@ struct BigInt {
val[1] = uint64_t(tmp >> 64);
return;
}
#endif // __SIZEOF_INT128__
#endif // LIBC_TYPES_HAS_INT128
if (LIBC_UNLIKELY(s == 0))
return;

Expand Down Expand Up @@ -753,7 +754,7 @@ struct BigInt {
val[1] = uint32_t(tmp >> 32);
return;
}
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
if constexpr ((Bits == 128) && (WORD_SIZE == 64)) {
// Use builtin 128 bits if available;
if (s >= 128) {
Expand All @@ -771,7 +772,7 @@ struct BigInt {
val[1] = uint64_t(tmp >> 64);
return;
}
#endif // __SIZEOF_INT128__
#endif // LIBC_TYPES_HAS_INT128

if (LIBC_UNLIKELY(s == 0))
return;
Expand Down
5 changes: 3 additions & 2 deletions libc/src/__support/UInt128.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#define LLVM_LIBC_SRC___SUPPORT_UINT128_H

#include "UInt.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

#if defined(__SIZEOF_INT128__)
#ifdef LIBC_TYPES_HAS_INT128
using UInt128 = __uint128_t;
using Int128 = __int128_t;
#else
using UInt128 = LIBC_NAMESPACE::UInt<128>;
using Int128 = LIBC_NAMESPACE::Int<128>;
#endif
#endif // LIBC_TYPES_HAS_INT128

#endif // LLVM_LIBC_SRC___SUPPORT_UINT128_H
7 changes: 7 additions & 0 deletions libc/src/__support/macros/properties/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "src/__support/macros/properties/cpu_features.h"
#include "src/__support/macros/properties/os.h"

#include <stdint.h> // __SIZEOF_INT128__

// 'long double' properties.
#if (LDBL_MANT_DIG == 53)
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
Expand All @@ -26,6 +28,11 @@
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128
#endif

// int128 / uint128 support
#if defined(__SIZEOF_INT128__)
#define LIBC_TYPES_HAS_INT128
#endif // defined(__SIZEOF_INT128__)

// -- float16 support ---------------------------------------------------------
// TODO: move this logic to "llvm-libc-types/float16.h"
#if defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2)
Expand Down
1 change: 1 addition & 0 deletions libc/test/UnitTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ add_unittest_framework_library(
libc.src.__support.CPP.string_view
libc.src.__support.CPP.type_traits
libc.src.__support.fixed_point.fx_rep
libc.src.__support.macros.properties.types
libc.src.__support.OSUtil.osutil
libc.src.__support.uint
libc.src.__support.uint128
Expand Down
5 changes: 3 additions & 2 deletions libc/test/UnitTest/LibcTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/UInt128.h"
#include "src/__support/fixed_point/fx_rep.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "test/UnitTest/TestLogger.h"

#if __STDC_HOSTED__
Expand Down Expand Up @@ -215,11 +216,11 @@ TEST_SPECIALIZATION(bool);

// We cannot just use a single UInt128 specialization as that resolves to only
// one type, UInt<128> or __uint128_t. We want both overloads as we want to
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
// When builtin __uint128_t type is available, include its specialization
// also.
TEST_SPECIALIZATION(__uint128_t);
#endif
#endif // LIBC_TYPES_HAS_INT128

TEST_SPECIALIZATION(LIBC_NAMESPACE::Int<128>);

Expand Down
5 changes: 3 additions & 2 deletions libc/test/UnitTest/TestLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "src/__support/OSUtil/io.h" // write_to_stderr
#include "src/__support/UInt.h" // is_big_int
#include "src/__support/UInt128.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

#include <stdint.h>

Expand Down Expand Up @@ -72,9 +73,9 @@ template TestLogger &TestLogger::operator<< <unsigned long>(unsigned long);
template TestLogger &
TestLogger::operator<< <unsigned long long>(unsigned long long);

#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
template TestLogger &TestLogger::operator<< <__uint128_t>(__uint128_t);
#endif
#endif // LIBC_TYPES_HAS_INT128
template TestLogger &TestLogger::operator<< <UInt<128>>(UInt<128>);
template TestLogger &TestLogger::operator<< <UInt<192>>(UInt<192>);
template TestLogger &TestLogger::operator<< <UInt<256>>(UInt<256>);
Expand Down
6 changes: 4 additions & 2 deletions libc/test/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
SRCS
uint_test.cpp
DEPENDS
libc.src.__support.uint
libc.src.__support.CPP.optional
libc.src.__support.macros.properties.types
libc.src.__support.uint
)
endif()

Expand All @@ -118,8 +119,9 @@ add_libc_test(
SRCS
integer_literals_test.cpp
DEPENDS
libc.src.__support.integer_literals
libc.src.__support.CPP.optional
libc.src.__support.integer_literals
libc.src.__support.macros.properties.types
)

add_libc_test(
Expand Down
2 changes: 2 additions & 0 deletions libc/test/src/__support/CPP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ add_libc_test(
bit_test.cpp
DEPENDS
libc.src.__support.CPP.bit
libc.src.__support.macros.properties.types
libc.src.__support.uint
)

Expand Down Expand Up @@ -49,6 +50,7 @@ add_libc_test(
limits_test.cpp
DEPENDS
libc.src.__support.CPP.limits
libc.src.__support.macros.properties.types
libc.src.__support.uint
)

Expand Down
9 changes: 5 additions & 4 deletions libc/test/src/__support/CPP/bit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@

#include "src/__support/CPP/bit.h"
#include "src/__support/UInt.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "test/UnitTest/Test.h"

#include <stdint.h>

namespace LIBC_NAMESPACE::cpp {

using UnsignedTypesNoBigInt = testing::TypeList<
#if defined(__SIZEOF_INT128__)
#if defined(LIBC_TYPES_HAS_INT128)
__uint128_t,
#endif
#endif // LIBC_TYPES_HAS_INT128
unsigned char, unsigned short, unsigned int, unsigned long,
unsigned long long>;

using UnsignedTypes = testing::TypeList<
#if defined(__SIZEOF_INT128__)
#if defined(LIBC_TYPES_HAS_INT128)
__uint128_t,
#endif
#endif // LIBC_TYPES_HAS_INT128
unsigned char, unsigned short, unsigned int, unsigned long,
unsigned long long, UInt<128>>;

Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/__support/CPP/limits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "src/__support/CPP/limits.h"
#include "src/__support/UInt.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "test/UnitTest/Test.h"

namespace LIBC_NAMESPACE {
Expand Down Expand Up @@ -36,9 +37,9 @@ TEST(LlvmLibcLimitsTest, UInt128Limits) {
auto umax64 = LIBC_NAMESPACE::UInt<128>(cpp::numeric_limits<uint64_t>::max());
EXPECT_GT(umax128, umax64);
ASSERT_EQ(~LIBC_NAMESPACE::UInt<128>(0), umax128);
#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
ASSERT_EQ(~__uint128_t(0), cpp::numeric_limits<__uint128_t>::max());
#endif
#endif // LIBC_TYPES_HAS_INT128
}

} // namespace LIBC_NAMESPACE
5 changes: 3 additions & 2 deletions libc/test/src/__support/integer_literals_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//

#include "src/__support/integer_literals.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
#include "test/UnitTest/Test.h"

using LIBC_NAMESPACE::operator""_u8;
Expand Down Expand Up @@ -66,7 +67,7 @@ TEST(LlvmLibcIntegerLiteralTest, u64) {
}

TEST(LlvmLibcIntegerLiteralTest, u128) {
#if defined(__SIZEOF_INT128__)
#ifdef LIBC_TYPES_HAS_INT128
const __uint128_t ZERO = 0;
const __uint128_t U8_MAX = UINT8_MAX;
const __uint128_t U16_MAX = UINT16_MAX;
Expand All @@ -80,7 +81,7 @@ TEST(LlvmLibcIntegerLiteralTest, u128) {
const UInt128 U32_MAX = UINT32_MAX;
const UInt128 U64_MAX = UINT64_MAX;
const UInt128 U128_MAX = (U64_MAX << 64) | U64_MAX;
#endif
#endif // LIBC_TYPES_HAS_INT128
EXPECT_EQ(ZERO, 0_u128);
EXPECT_EQ(U8_MAX, 255_u128);
EXPECT_EQ(U8_MAX, 0xFF_u128);
Expand Down
9 changes: 5 additions & 4 deletions libc/test/src/__support/uint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "src/__support/CPP/optional.h"
#include "src/__support/UInt.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128

#include "test/UnitTest/Test.h"
#include <math.h> // HUGE_VALF, HUGE_VALF
Expand Down Expand Up @@ -41,7 +42,7 @@ TEST(LlvmLibcUIntClassTest, BitCastToFromDouble) {
}
}

#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128
TEST(LlvmLibcUIntClassTest, BitCastToFromNativeUint128) {
static_assert(cpp::is_trivially_copyable<LL_UInt128>::value);
static_assert(sizeof(LL_UInt128) == sizeof(__uint128_t));
Expand All @@ -52,7 +53,7 @@ TEST(LlvmLibcUIntClassTest, BitCastToFromNativeUint128) {
EXPECT_TRUE(value == forth);
}
}
#endif
#endif // LIBC_TYPES_HAS_INT128

#ifdef LIBC_TYPES_HAS_FLOAT128
TEST(LlvmLibcUIntClassTest, BitCastToFromNativeFloat128) {
Expand Down Expand Up @@ -652,7 +653,7 @@ TEST(LlvmLibcUIntClassTest, BasicArithmeticInt128Tests) {
ASSERT_EQ(c * b, b);
}

#ifdef __SIZEOF_INT128__
#ifdef LIBC_TYPES_HAS_INT128

TEST(LlvmLibcUIntClassTest, ConstructorFromUInt128Tests) {
__uint128_t a = (__uint128_t(123) << 64) + 1;
Expand Down Expand Up @@ -707,7 +708,7 @@ TEST(LlvmLibcUIntClassTest, WordTypeUInt128Tests) {
EXPECT_TRUE(f == r);
}

#endif // __SIZEOF_INT128__
#endif // LIBC_TYPES_HAS_INT128

TEST(LlvmLibcUIntClassTest, OtherWordTypeTests) {
using LL_UInt96 = BigInt<96, false, uint32_t>;
Expand Down
8 changes: 2 additions & 6 deletions libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#include <type_traits>
#include <utility>

#include "test_macros.h"
#include "test_iterators.h"
#include "test_macros.h"
#include "test_range.h"

int globalBuff[8];

Expand Down Expand Up @@ -82,11 +83,6 @@ struct RandomAccessRange {
template<>
inline constexpr bool std::ranges::enable_borrowed_range<RandomAccessRange> = true;

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

constexpr bool test() {
{
ASSERT_SAME_TYPE(decltype(std::views::all(View<true>())), View<true>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
#include <utility>

#include "test_iterators.h"

template <class View, class T>
concept CanBePiped = requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};
#include "test_range.h"

struct Pred {
constexpr bool operator()(int x, int y) const { return x != -y; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
#include <utility>

#include "test_iterators.h"
#include "test_range.h"
#include "types.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

constexpr bool test() {
int buf[] = {1, 2, 3};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <type_traits>
#include <utility>

#include "test_range.h"

struct Pred {
constexpr bool operator()(int i) const { return i < 3; }
};
Expand Down Expand Up @@ -51,12 +53,6 @@ static_assert(std::is_invocable_v<decltype((std::views::drop_while)), int (&)[2]
static_assert(!std::is_invocable_v<decltype((std::views::drop_while)), Foo (&)[2], Pred>);
static_assert(std::is_invocable_v<decltype((std::views::drop_while)), MoveOnlyView, Pred>);

template <class View, class T>
concept CanBePiped =
requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

static_assert(!CanBePiped<MoveOnlyView, decltype(std::views::drop_while)>);
static_assert(CanBePiped<MoveOnlyView, decltype(std::views::drop_while(Pred{}))>);
static_assert(!CanBePiped<int, decltype(std::views::drop_while(Pred{}))>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
#include <span>
#include <string_view>
#include <utility>
#include "test_iterators.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};
#include "test_iterators.h"
#include "test_range.h"

struct SizedView : std::ranges::view_base {
int* begin_ = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <type_traits>
#include <utility>

#include "test_range.h"

template <class T>
struct View : std::ranges::view_base {
T* begin() const;
Expand All @@ -41,12 +43,6 @@ static_assert(!std::is_invocable_v<decltype((std::views::values)), View<int>>);
static_assert(std::is_invocable_v<decltype((std::views::values)), View<std::pair<int, int>>>);
static_assert(!std::is_invocable_v<decltype((std::views::values)), View<std::tuple<int>>>);

template <class View, class T>
concept CanBePiped =
requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

static_assert(!CanBePiped<View<int>, decltype((std::views::elements<0>))>);
static_assert(CanBePiped<View<std::pair<int, int>>, decltype((std::views::elements<0>))>);
static_assert(CanBePiped<View<std::tuple<int>>, decltype((std::views::elements<0>))>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
#include <utility>

#include "test_iterators.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};
#include "test_range.h"

struct NonCopyablePredicate {
NonCopyablePredicate(NonCopyablePredicate const&) = delete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <cassert>
#include <type_traits>

#include "test_range.h"
#include "types.h"

struct MoveOnlyOuter : SimpleForwardCommonOuter<ForwardCommonInner> {
Expand All @@ -32,11 +33,6 @@ struct Foo {
constexpr Foo(int ii) : i(ii) {}
};

template <class View, class T>
concept CanBePiped = requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

constexpr bool test() {
int buffer1[3] = {1, 2, 3};
int buffer2[2] = {4, 5};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@
#include <utility>

#include "test_iterators.h"
#include "test_range.h"
#include "types.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

struct SomeView : std::ranges::view_base {
const std::string_view* v_;
constexpr SomeView(const std::string_view& v) : v_(&v) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
#include <iterator>
#include <utility>

#include "test_range.h"
#include "types.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

constexpr bool test() {
int buf[] = {1, 2, 3};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
#include <utility>

#include "test_iterators.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};
#include "test_range.h"

struct SomeView : std::ranges::view_base {
const std::string_view* v_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <type_traits>
#include <utility>

#include "test_range.h"
#include "types.h"

struct Pred {
Expand All @@ -42,12 +43,6 @@ static_assert(std::is_invocable_v<decltype((std::views::take_while)), int (&)[2]
static_assert(!std::is_invocable_v<decltype((std::views::take_while)), Foo (&)[2], Pred>);
static_assert(std::is_invocable_v<decltype((std::views::take_while)), MoveOnlyView, Pred>);

template <class View, class T>
concept CanBePiped =
requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

static_assert(!CanBePiped<MoveOnlyView, decltype(std::views::take_while)>);
static_assert(CanBePiped<MoveOnlyView, decltype(std::views::take_while(Pred{}))>);
static_assert(!CanBePiped<int, decltype(std::views::take_while(Pred{}))>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
#include <span>
#include <string_view>
#include <utility>
#include "test_iterators.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};
#include "test_iterators.h"
#include "test_range.h"

struct SizedView : std::ranges::view_base {
int* begin_ = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
#include <utility>

#include "test_macros.h"
#include "test_range.h"
#include "types.h"

template <class View, class T>
concept CanBePiped = requires (View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

struct NonCopyableFunction {
NonCopyableFunction(NonCopyableFunction const&) = delete;
template <class T>
Expand Down
5 changes: 5 additions & 0 deletions libcxx/test/support/test_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ concept simple_view =
std::same_as<std::ranges::iterator_t<Range>, std::ranges::iterator_t<const Range>> &&
std::same_as<std::ranges::sentinel_t<Range>, std::ranges::sentinel_t<const Range>>;

template <class View, class T>
concept CanBePiped = requires(View&& view, T&& t) {
{ std::forward<View>(view) | std::forward<T>(t) };
};

#endif // LIBCXX_TEST_SUPPORT_TEST_RANGE_H
31 changes: 29 additions & 2 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,8 @@ Syntax::

A function definition contains a list of basic blocks, forming the CFG (Control
Flow Graph) for the function. Each basic block may optionally start with a label
(giving the basic block a symbol table entry), contains a list of instructions,
(giving the basic block a symbol table entry), contains a list of instructions
and :ref:`debug records <debugrecords>`,
and ends with a :ref:`terminator <terminators>` instruction (such as a branch or
function return). If an explicit label name is not provided, a block is assigned
an implicit numbered label, using the next value from the same counter as used
Expand Down Expand Up @@ -8541,7 +8542,10 @@ The LLVM instruction set consists of several different classifications
of instructions: :ref:`terminator instructions <terminators>`, :ref:`binary
instructions <binaryops>`, :ref:`bitwise binary
instructions <bitwiseops>`, :ref:`memory instructions <memoryops>`, and
:ref:`other instructions <otherops>`.
:ref:`other instructions <otherops>`. There are also :ref:`debug records
<debugrecords>`, which are not instructions themselves but are printed
interleaved with instructions to describe changes in the state of the program's
debug information at each position in the program's execution.

.. _terminators:

Expand Down Expand Up @@ -12695,6 +12699,29 @@ Example:

%tok = cleanuppad within %cs []

.. _debugrecords:

Debug Records
-----------------------

Debug records appear interleaved with instructions, but are not instructions;
they are used only to define debug information, and have no effect on generated
code. They are distinguished from instructions by the use of a leading `#` and
an extra level of indentation. As an example:

.. code-block:: llvm

%inst1 = op1 %a, %b
#dbg_value(%inst1, !10, !DIExpression(), !11)
%inst2 = op2 %inst1, %c

These debug records are an optional replacement for
:ref:`debug intrinsics<dbg_intrinsics>`. Debug records will be output if the
``--write-experimental-debuginfo`` flag is passed to LLVM; it is an error for both
records and intrinsics to appear in the same module. More information about
debug records can be found in the `LLVM Source Level Debugging
<SourceLevelDebugging.html#format-common-intrinsics>`_ document.

.. _intrinsics:

Intrinsic Functions
Expand Down
66 changes: 66 additions & 0 deletions llvm/docs/SourceLevelDebugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ conventions used by the C and C++ front-ends.
Debug information descriptors are `specialized metadata nodes
<LangRef.html#specialized-metadata>`_, first-class subclasses of ``Metadata``.

There are two models for defining the values of source variables at different
states of the program and tracking these values through optimization and code
generation: :ref:`intrinsic function calls <format_common_intrinsics>`, the
current default, and :ref:`debug records <debug_records>`, which are a new
non-instruction-based model
(for an explanation of how this works and why it is desirable, see the
`RemoveDIs <RemoveDIsDebugInfo.html>`_ document). Each module must use one or
the other; they may never be mixed within an IR module. To enable writing debug
records instead of intrinsic calls, use the flag
``--write-experimental-debuginfo``.

.. _format_common_intrinsics:

Debugger intrinsic functions
Expand Down Expand Up @@ -268,6 +279,61 @@ The formal LLVM-IR signature is:
See :doc:`AssignmentTracking` for more info.

.. _debug_records:

Debug Records
----------------------------

LLVM also has an alternative to intrinsic functions, debug records, which
function similarly but are not instructions. The basic syntax for debug records
is:

.. code-block:: llvm
#dbg_<kind>([<arg>, ]* <DILocation>)
; Using the intrinsic model, the above is equivalent to:
call void llvm.dbg.<kind>([metadata <arg>, ]*), !dbg <DILocation>
A debug intrinsic function can be converted to a debug record with the
following steps:

1. Add an extra level of indentation.
2. Replace everything prior to the intrinsic kind (declare/value/assign) with
``#dbg_``.
3. Remove the leading ``metadata`` from the intrinsic's arguments.
4. Transfer the ``!dbg`` attachment to be an argument, dropping the leading
``!dbg``.

For each kind of intrinsic function, there is an equivalent debug record.

``#dbg_declare``
^^^^^^^^^^^^^^^^

.. code-block:: llvm
#dbg_declare([Value|MDNode], DILocalVariable, DIExpression, DILocation)
Equivalent to the ``llvm.dbg.declare`` intrinsic.

``#dbg_value``
^^^^^^^^^^^^^^

.. code-block:: llvm
#dbg_value([Value|DIArgList|MDNode], DILocalVariable, DIExpression, DILocation)
Equivalent to the ``llvm.dbg.value`` intrinsic.

``#dbg_assign``
^^^^^^^^^^^^^^^

.. code-block:: llvm
#dbg_assign([Value|DIArgList|MDNode], DILocalVariable, DIExpression,
DIAssignID, [Value|MDNode], DIExpression, DILocation)
Equivalent to the ``llvm.dbg.assign`` intrinsic.

Object lifetimes and scoping
============================

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86SchedIceLake.td
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ defm : ICXWriteResPair<WriteVarShuffle, [ICXPort5], 1, [1], 1, 5>; // Vector v
defm : ICXWriteResPair<WriteVarShuffleX, [ICXPort15], 1, [1], 1, 6>;
defm : ICXWriteResPair<WriteVarShuffleY, [ICXPort15], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteVarShuffleZ, [ICXPort5], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteBlend, [ICXPort5], 1, [1], 1, 6>; // Vector blends.
defm : ICXWriteResPair<WriteBlendY,[ICXPort5], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteBlendZ,[ICXPort5], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteBlend, [ICXPort15], 1, [1], 1, 6>; // Vector blends.
defm : ICXWriteResPair<WriteBlendY,[ICXPort15], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteBlendZ,[ICXPort15], 1, [1], 1, 7>;
defm : ICXWriteResPair<WriteVarBlend, [ICXPort015], 2, [2], 2, 6>; // Vector variable blends.
defm : ICXWriteResPair<WriteVarBlendY,[ICXPort015], 2, [2], 2, 6>;
defm : ICXWriteResPair<WriteVarBlendZ,[ICXPort05], 2, [1], 1, 6>;
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx1.s
Original file line number Diff line number Diff line change
Expand Up @@ -1401,8 +1401,8 @@ vzeroupper
# CHECK-NEXT: 2 7 0.50 * vpavgw (%rax), %xmm1, %xmm2
# CHECK-NEXT: 2 2 0.67 vpblendvb %xmm3, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: 3 8 0.67 * vpblendvb %xmm3, (%rax), %xmm1, %xmm2
# CHECK-NEXT: 1 1 1.00 vpblendw $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: 2 7 1.00 * vpblendw $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: 1 1 0.50 vpblendw $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: 2 7 0.50 * vpblendw $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: 1 6 1.00 vpclmulqdq $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: 2 12 1.00 * vpclmulqdq $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: 1 1 0.50 vpcmpeqb %xmm0, %xmm1, %xmm2
Expand Down Expand Up @@ -1738,7 +1738,7 @@ vzeroupper

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
# CHECK-NEXT: - 126.00 322.92 231.92 160.50 160.50 19.00 297.92 6.25 19.00 19.00 19.00
# CHECK-NEXT: - 126.00 322.92 232.92 160.50 160.50 19.00 296.92 6.25 19.00 19.00 19.00

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions:
Expand Down Expand Up @@ -2113,8 +2113,8 @@ vzeroupper
# CHECK-NEXT: - - 0.50 0.50 0.50 0.50 - - - - - - vpavgw (%rax), %xmm1, %xmm2
# CHECK-NEXT: - - 0.67 0.67 - - - 0.67 - - - - vpblendvb %xmm3, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: - - 0.67 0.67 0.50 0.50 - 0.67 - - - - vpblendvb %xmm3, (%rax), %xmm1, %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - vpblendw $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpblendw $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - vpblendw $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpblendw $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - vpclmulqdq $11, %xmm0, %xmm1, %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpclmulqdq $11, (%rax), %xmm1, %xmm2
# CHECK-NEXT: - - 0.50 0.50 - - - - - - - - vpcmpeqb %xmm0, %xmm1, %xmm2
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx2.s
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ vpxor (%rax), %ymm1, %ymm2
# CHECK-NEXT: 2 8 0.50 * vpblendd $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: 2 2 0.67 vpblendvb %ymm3, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: 3 8 0.67 * vpblendvb %ymm3, (%rax), %ymm1, %ymm2
# CHECK-NEXT: 1 1 1.00 vpblendw $11, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: 2 8 1.00 * vpblendw $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: 1 1 0.50 vpblendw $11, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: 2 8 0.50 * vpblendw $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: 1 3 1.00 vpbroadcastb %xmm0, %xmm0
# CHECK-NEXT: 2 7 1.00 * vpbroadcastb (%rax), %xmm0
# CHECK-NEXT: 1 3 1.00 vpbroadcastb %xmm0, %ymm0
Expand Down Expand Up @@ -778,7 +778,7 @@ vpxor (%rax), %ymm1, %ymm2

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
# CHECK-NEXT: - - 110.33 102.33 98.00 98.00 2.50 151.33 - 2.50 2.50 2.50
# CHECK-NEXT: - - 110.33 103.33 98.00 98.00 2.50 150.33 - 2.50 2.50 2.50

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions:
Expand Down Expand Up @@ -846,8 +846,8 @@ vpxor (%rax), %ymm1, %ymm2
# CHECK-NEXT: - - 0.33 0.33 0.50 0.50 - 0.33 - - - - vpblendd $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: - - 0.67 0.67 - - - 0.67 - - - - vpblendvb %ymm3, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: - - 0.67 0.67 0.50 0.50 - 0.67 - - - - vpblendvb %ymm3, (%rax), %ymm1, %ymm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - vpblendw $11, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpblendw $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - vpblendw $11, %ymm0, %ymm1, %ymm2
# CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpblendw $11, (%rax), %ymm1, %ymm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - vpbroadcastb %xmm0, %xmm0
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpbroadcastb (%rax), %xmm0
# CHECK-NEXT: - - - - - - - 1.00 - - - - vpbroadcastb %xmm0, %ymm0
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-sse41.s
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ roundss $1, (%rax), %xmm2
# CHECK-NEXT: 2 10 1.00 * packusdw (%rax), %xmm2
# CHECK-NEXT: 2 2 0.67 pblendvb %xmm0, %xmm0, %xmm2
# CHECK-NEXT: 3 8 0.67 * pblendvb %xmm0, (%rax), %xmm2
# CHECK-NEXT: 1 1 1.00 pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: 2 7 1.00 * pblendw $11, (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: 2 7 0.50 * pblendw $11, (%rax), %xmm2
# CHECK-NEXT: 1 1 0.50 pcmpeqq %xmm0, %xmm2
# CHECK-NEXT: 2 7 0.50 * pcmpeqq (%rax), %xmm2
# CHECK-NEXT: 2 3 1.00 pextrb $1, %xmm0, %ecx
Expand Down Expand Up @@ -268,7 +268,7 @@ roundss $1, (%rax), %xmm2

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
# CHECK-NEXT: - - 36.67 40.67 22.00 22.00 2.50 54.67 - 2.50 2.50 2.50
# CHECK-NEXT: - - 36.67 41.67 22.00 22.00 2.50 53.67 - 2.50 2.50 2.50

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions:
Expand All @@ -295,8 +295,8 @@ roundss $1, (%rax), %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - packusdw (%rax), %xmm2
# CHECK-NEXT: - - 0.67 0.67 - - - 0.67 - - - - pblendvb %xmm0, %xmm0, %xmm2
# CHECK-NEXT: - - 0.67 0.67 0.50 0.50 - 0.67 - - - - pblendvb %xmm0, (%rax), %xmm2
# CHECK-NEXT: - - - - - - - 1.00 - - - - pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - pblendw $11, (%rax), %xmm2
# CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - pblendw $11, %xmm0, %xmm2
# CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - pblendw $11, (%rax), %xmm2
# CHECK-NEXT: - - 0.50 0.50 - - - - - - - - pcmpeqq %xmm0, %xmm2
# CHECK-NEXT: - - 0.50 0.50 0.50 0.50 - - - - - - pcmpeqq (%rax), %xmm2
# CHECK-NEXT: - - 1.00 - - - - 1.00 - - - - pextrb $1, %xmm0, %ecx
Expand Down
3 changes: 3 additions & 0 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ libc_support_library(
deps = [
"__support_cpp_type_traits",
"__support_macros_attributes",
":__support_macros_properties_types",
":llvm_libc_macros_limits_macros",
],
)
Expand Down Expand Up @@ -449,6 +450,7 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_macros_attributes",
":__support_macros_optimization",
":__support_macros_properties_types",
":__support_math_extras",
":__support_number_pair",
],
Expand All @@ -458,6 +460,7 @@ libc_support_library(
name = "__support_uint128",
hdrs = ["src/__support/UInt128.h"],
deps = [
":__support_macros_properties_types",
":__support_uint",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ libc_support_library(
deps = [
"//libc:__support_cpp_string",
"//libc:__support_cpp_string_view",
"//libc:__support_macros_properties_types",
"//libc:__support_osutil_io",
"//libc:__support_uint",
"//libc:__support_uint128",
Expand Down Expand Up @@ -52,6 +53,7 @@ libc_support_library(
"//libc:__support_fputil_fpbits_str",
"//libc:__support_fputil_rounding_mode",
"//libc:__support_macros_properties_architectures",
"//libc:__support_macros_properties_types",
"//libc:__support_stringutil",
"//libc:__support_uint128",
"//libc:errno",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ libc_test(
srcs = ["uint_test.cpp"],
deps = [
"//libc:__support_cpp_optional",
"//libc:__support_macros_properties_types",
"//libc:__support_uint",
],
)
Expand All @@ -111,5 +112,6 @@ libc_test(
srcs = ["integer_literals_test.cpp"],
deps = [
"//libc:__support_integer_literals",
"//libc:__support_macros_properties_types",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ libc_test(
srcs = ["bit_test.cpp"],
deps = [
"//libc:__support_cpp_bit",
"//libc:__support_macros_properties_types",
"//libc:__support_uint",
],
)
Expand All @@ -48,6 +49,7 @@ libc_test(
srcs = ["limits_test.cpp"],
deps = [
"//libc:__support_cpp_limits",
"//libc:__support_macros_properties_types",
"//libc:__support_uint",
],
)
Expand Down