1*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s \ 2*67e74705SXin Li // RUN: -fsanitize=signed-integer-overflow \ 3*67e74705SXin Li // RUN: | FileCheck %s 4*67e74705SXin Li 5*67e74705SXin Li // Verify we emit constants for "immediate" inline assembly arguments. 6*67e74705SXin Li // Emitting a scalar expression can make the immediate be generated as 7*67e74705SXin Li // overflow intrinsics, if the overflow sanitizer is enabled. 8*67e74705SXin Li 9*67e74705SXin Li // Check both 'i' and 'I': 10*67e74705SXin Li // - 'i' accepts symbolic constants. 11*67e74705SXin Li // - 'I' doesn't, and is really an immediate-required constraint. 12*67e74705SXin Li 13*67e74705SXin Li // See also PR23517. 14*67e74705SXin Li 15*67e74705SXin Li // CHECK-LABEL: @test_inlineasm_i 16*67e74705SXin Li // CHECK: call void asm sideeffect "int $0", "i{{.*}}"(i32 2) test_inlineasm_i()17*67e74705SXin Livoid test_inlineasm_i() { 18*67e74705SXin Li __asm__ __volatile__("int %0" :: "i"(1 + 1)); 19*67e74705SXin Li } 20*67e74705SXin Li 21*67e74705SXin Li // CHECK-LABEL: @test_inlineasm_I 22*67e74705SXin Li // CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 2) 23*67e74705SXin Li // CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 3) test_inlineasm_I()24*67e74705SXin Livoid test_inlineasm_I() { 25*67e74705SXin Li __asm__ __volatile__("int %0" :: "I"(1 + 1)); 26*67e74705SXin Li 27*67e74705SXin Li // Also check a C non-ICE. 28*67e74705SXin Li static const int N = 1; 29*67e74705SXin Li __asm__ __volatile__("int %0" :: "I"(N + 2)); 30*67e74705SXin Li } 31