Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/inline-asm-intel.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

85 lines
3.6 KiB
C

// REQUIRES: x86-registered-target
/// Accept intel inline asm but write it out as att:
// RUN: %clang_cc1 -triple i386-unknown-linux -mllvm -x86-asm-syntax=att -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - | FileCheck --check-prefix=ATT %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux -mllvm -x86-asm-syntax=att -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - | FileCheck --check-prefix=ATT %s
/// Accept intel inline asm and write it out as intel:
// RUN: %clang_cc1 -triple i386-unknown-linux -mllvm -x86-asm-syntax=intel -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - | FileCheck --check-prefix=INTEL %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux -mllvm -x86-asm-syntax=intel -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - | FileCheck --check-prefix=INTEL %s
/// Check MS compat mode (_MSC_VER defined). The driver always picks intel
/// output in that mode, so test only that.
// RUN: %clang_cc1 -triple i386-pc-win32 -mllvm -x86-asm-syntax=intel -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 | FileCheck --check-prefix=INTEL %s
// RUN: %clang_cc1 -triple x86_64-pc-win32 -mllvm -x86-asm-syntax=intel -inline-asm=intel -Werror -target-feature +hreset -target-feature +pconfig -target-feature +sgx -ffreestanding -O0 -S %s -o - -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 | FileCheck --check-prefix=INTEL %s
// Test that intrinsics headers still work with -masm=intel.
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
void f(void) {
// Intrinsic headers contain macros and inline functions.
// Inline assembly in both are checked only when they are
// referenced, so reference a few intrinsics here.
__SSC_MARK(4);
int a;
_hreset(a);
_pconfig_u32(0, (void*)0);
_encls_u32(0, (void*)0);
_enclu_u32(0, (void*)0);
_enclv_u32(0, (void*)0);
#ifdef _MSC_VER
__movsb((void*)0, (void*)0, 0);
__movsd((void*)0, (void*)0, 0);
__movsw((void*)0, (void*)0, 0);
__stosb((void*)0, 0, 0);
__stosd((void*)0, 0, 0);
__stosw((void*)0, 0, 0);
#ifdef __x86_64__
__movsq((void*)0, (void*)0, 0);
__stosq((void*)0, 0, 0);
#endif
__cpuid((void*)0, 0);
__cpuidex((void*)0, 0, 0);
__halt();
__nop();
__readmsr(0);
__readcr3();
__writecr3(0);
_InterlockedExchange_HLEAcquire((void*)0, 0);
_InterlockedExchange_HLERelease((void*)0, 0);
_InterlockedCompareExchange_HLEAcquire((void*)0, 0, 0);
_InterlockedCompareExchange_HLERelease((void*)0, 0, 0);
#ifdef __x86_64__
_InterlockedExchange64_HLEAcquire((void*)0, 0);
_InterlockedExchange64_HLERelease((void*)0, 0);
_InterlockedCompareExchange64_HLEAcquire((void*)0, 0, 0);
_InterlockedCompareExchange64_HLERelease((void*)0, 0, 0);
#endif
#endif
__asm__("mov eax, ebx");
// ATT: movl %ebx, %eax
// INTEL: mov eax, ebx
// Explicitly overriding asm style per block works:
__asm__(".att_syntax\nmovl %ebx, %eax");
// ATT: movl %ebx, %eax
// INTEL: mov eax, ebx
// The .att_syntax was only scoped to the previous statement.
// (This is different from gcc, where `.att_syntax` is in
// effect from that point on, so portable code would want an
// explicit `.intel_syntax noprefix\n` at the start of this string).
__asm__("mov eax, ebx");
// ATT: movl %ebx, %eax
// INTEL: mov eax, ebx
}