[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -2502,10 +2509,25 @@ _mm_mulhi_pu16(__m64 __a, __m64 __b) ///A pointer to a 64-bit memory location that will receive the conditionally ///copied integer values. The address of the memory location does not have ///to be aligned. -static __inline__ void __DEFAULT_FN_ATTRS_MMX +static __inline__ void __DEFAULT_FN_ATTRS_SSE2 _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p) { - __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p); + // This is complex, because we need to support the case where __p is pointing + // within the last 15 to 8 bytes of a page. In that case, using a 128-bit + // write might cause a trap where a 64-bit maskmovq would not. (Memory + // locations not selected by the mask bits might still cause traps.) + __m128i __d128 = __anyext128(__d); + __m128i __n128 = __zext128(__n); + if (((__SIZE_TYPE__)__p & 0xfff) >= 4096-15 && + ((__SIZE_TYPE__)__p & 0xfff) <= 4096-8) { phoebewang wrote: `<` ? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -494,10 +520,10 @@ _mm_adds_pu16(__m64 __m1, __m64 __m2) ///A 64-bit integer vector of [8 x i8] containing the subtrahends. /// \returns A 64-bit integer vector of [8 x i8] containing the differences of ///both parameters. -static __inline__ __m64 __DEFAULT_FN_ATTRS +static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sub_pi8(__m64 __m1, __m64 __m2) { -return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2); +return (__m64)(((__v8qu)__m1) - ((__v8qu)__m2)); phoebewang wrote: Seems you intended to use unsigned version. What's the reason to do so? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -0,0 +1,29 @@ +USE_XMM= phoebewang wrote: What these tests used for? Is your local tool uploaded unintentionally or you want them to be reviewed as well? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -124,10 +143,11 @@ _mm_cvtm64_si64(__m64 __m) ///written to the upper 32 bits of the result. /// \returns A 64-bit integer vector of [8 x i8] containing the converted ///values. -static __inline__ __m64 __DEFAULT_FN_ATTRS +static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_packs_pi16(__m64 __m1, __m64 __m2) { -return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2); +return __extract2_32(__builtin_ia32_packsswb128((__v8hi)__anyext128(__m1), phoebewang wrote: Should it be better to shuffle `__m1` and `__m2` first and then `__trunc64`? The same for below. https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -177,7 +175,10 @@ _mm_abs_epi32(__m128i __a) /// \returns A 64-bit integer vector containing the concatenated right-shifted ///value. #define _mm_alignr_pi8(a, b, n) \ - ((__m64)__builtin_ia32_palignr((__v8qi)(__m64)(a), (__v8qi)(__m64)(b), (n))) + ((__m64)__builtin_shufflevector( \ phoebewang wrote: __trunc64? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -21,10 +21,29 @@ typedef int __v2si __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); typedef char __v8qi __attribute__((__vector_size__(8))); +/* Unsigned types */ +typedef unsigned long long __v1du __attribute__ ((__vector_size__ (8))); +typedef unsigned int __v2su __attribute__ ((__vector_size__ (8))); +typedef unsigned short __v4hu __attribute__((__vector_size__(8))); +typedef unsigned char __v8qu __attribute__((__vector_size__(8))); + +/* We need an explicitly signed variant for char. Note that this shouldn't + * appear in the interface though. */ +typedef signed char __v8qs __attribute__((__vector_size__(8))); + +/* SSE/SSE2 types */ +typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__((__vector_size__(16))); +typedef short __v8hi __attribute__((__vector_size__(16))); +typedef char __v16qi __attribute__((__vector_size__(16))); + /* Define the default attributes for the functions in this file. */ -#define __DEFAULT_FN_ATTRS \ - __attribute__((__always_inline__, __nodebug__, __target__("mmx,no-evex512"), \ - __min_vector_width__(64))) +#define __DEFAULT_FN_ATTRS_SSE2 __attribute__((__always_inline__, __nodebug__, __target__("sse2,no-evex512"), __min_vector_width__(64))) phoebewang wrote: Since we use SSE vector instructions, we need to see `__min_vector_width__(128)` https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -811,10 +843,11 @@ _mm_slli_pi32(__m64 __m, int __count) ///A 64-bit integer vector interpreted as a single 64-bit integer. /// \returns A 64-bit integer vector containing the left-shifted value. If /// \a __count is greater or equal to 64, the result is set to 0. -static __inline__ __m64 __DEFAULT_FN_ATTRS +static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_sll_si64(__m64 __m, __m64 __count) { -return (__m64)__builtin_ia32_psllq((__v1di)__m, __count); +return __trunc64(__builtin_ia32_psllq128((__v2di)__anyext128(__m), + __anyext128(__count))); phoebewang wrote: Missing `(__v2di)`? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -614,12 +623,15 @@ _mm_shuffle_epi8(__m128i __a, __m128i __b) ///1: Clear the corresponding byte in the destination. \n ///0: Copy the selected source byte to the corresponding byte in the ///destination. \n -///Bits [3:0] select the source byte to be copied. +///Bits [2:0] select the source byte to be copied. /// \returns A 64-bit integer vector containing the copied or cleared values. -static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX +static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_shuffle_pi8(__m64 __a, __m64 __b) { -return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b); +return __trunc64(__builtin_ia32_pshufb128( +(__v16qi)__builtin_shufflevector( +(__v2si)(__a), __extension__ (__v2si){}, 0, 1, 0, 1), phoebewang wrote: Why don't `__anyext128`? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -150,8 +150,8 @@ TARGET_BUILTIN(__builtin_ia32_pmovmskb, "iV8c", "ncV:64:", "mmx,sse") TARGET_BUILTIN(__builtin_ia32_pmulhuw, "V4sV4sV4s", "ncV:64:", "mmx,sse") TARGET_BUILTIN(__builtin_ia32_psadbw, "V4sV8cV8c", "ncV:64:", "mmx,sse") TARGET_BUILTIN(__builtin_ia32_pshufw, "V4sV4sIc", "ncV:64:", "mmx,sse") -TARGET_BUILTIN(__builtin_ia32_vec_ext_v4hi, "iV4sIi", "ncV:64:", "mmx,sse") -TARGET_BUILTIN(__builtin_ia32_vec_set_v4hi, "V4sV4siIi", "ncV:64:", "mmx,sse") +TARGET_BUILTIN(__builtin_ia32_vec_ext_v4hi, "sV4sIi", "ncV:64:", "sse") +TARGET_BUILTIN(__builtin_ia32_vec_set_v4hi, "V4sV4ssIi", "ncV:64:", "sse") phoebewang wrote: I see there's only one use of them, why don't use __trunc64/__anyext128 for them too? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -1035,10 +1077,11 @@ _mm_srli_pi32(__m64 __m, int __count) /// \param __count ///A 64-bit integer vector interpreted as a single 64-bit integer. /// \returns A 64-bit integer vector containing the right-shifted value. -static __inline__ __m64 __DEFAULT_FN_ATTRS +static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_srl_si64(__m64 __m, __m64 __count) { -return (__m64)__builtin_ia32_psrlq((__v1di)__m, __count); +return __trunc64(__builtin_ia32_psrlq128((__v2di)__anyext128(__m), + __anyext128(__count))); phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -242,10 +243,11 @@ _mm_hadd_epi32(__m128i __a, __m128i __b) ///destination. /// \returns A 64-bit vector of [4 x i16] containing the horizontal sums of both ///operands. -static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX +static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hadd_pi16(__m64 __a, __m64 __b) { -return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b); +return __extract2_32(__builtin_ia32_phaddw128((__v8hi)__anyext128(__a), phoebewang wrote: Shuffle first and then __trunc64? The same below. https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -337,10 +363,10 @@ _mm_unpacklo_pi32(__m64 __m1, __m64 __m2) ///A 64-bit integer vector of [8 x i8]. /// \returns A 64-bit integer vector of [8 x i8] containing the sums of both ///parameters. -static __inline__ __m64 __DEFAULT_FN_ATTRS +static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2 _mm_add_pi8(__m64 __m1, __m64 __m2) { -return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2); +return (__m64)(((__v8qu)__m1) + ((__v8qu)__m2)); phoebewang wrote: `__v8qi`? Same for below. https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -21,10 +21,29 @@ typedef int __v2si __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); typedef char __v8qi __attribute__((__vector_size__(8))); +/* Unsigned types */ +typedef unsigned long long __v1du __attribute__ ((__vector_size__ (8))); +typedef unsigned int __v2su __attribute__ ((__vector_size__ (8))); +typedef unsigned short __v4hu __attribute__((__vector_size__(8))); +typedef unsigned char __v8qu __attribute__((__vector_size__(8))); + +/* We need an explicitly signed variant for char. Note that this shouldn't + * appear in the interface though. */ +typedef signed char __v8qs __attribute__((__vector_size__(8))); + +/* SSE/SSE2 types */ +typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__((__vector_size__(16))); +typedef short __v8hi __attribute__((__vector_size__(16))); +typedef char __v16qi __attribute__((__vector_size__(16))); phoebewang wrote: These already defined in emmintrin.h https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -2539,9 +2536,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sub_epi32(__m128i __a, ///A 64-bit integer vector containing the subtrahend. /// \returns A 64-bit integer vector containing the difference of the values in ///the operands. -static __inline__ __m64 __DEFAULT_FN_ATTRS_MMX _mm_sub_si64(__m64 __a, -__m64 __b) { - return (__m64)__builtin_ia32_psubq((__v1di)__a, (__v1di)__b); +static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_sub_si64(__m64 __a, __m64 __b) { + return (__m64)((unsigned long long)__a - (unsigned long long)__b); phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Clang: convert `__m64` intrinsics to unconditionally use SSE2 instead of MMX. (PR #96540)
@@ -21,10 +21,29 @@ typedef int __v2si __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); typedef char __v8qi __attribute__((__vector_size__(8))); +/* Unsigned types */ +typedef unsigned long long __v1du __attribute__ ((__vector_size__ (8))); +typedef unsigned int __v2su __attribute__ ((__vector_size__ (8))); +typedef unsigned short __v4hu __attribute__((__vector_size__(8))); +typedef unsigned char __v8qu __attribute__((__vector_size__(8))); + +/* We need an explicitly signed variant for char. Note that this shouldn't + * appear in the interface though. */ +typedef signed char __v8qs __attribute__((__vector_size__(8))); + +/* SSE/SSE2 types */ +typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16))); +typedef long long __v2di __attribute__ ((__vector_size__ (16))); +typedef int __v4si __attribute__((__vector_size__(16))); +typedef short __v8hi __attribute__((__vector_size__(16))); +typedef char __v16qi __attribute__((__vector_size__(16))); + /* Define the default attributes for the functions in this file. */ -#define __DEFAULT_FN_ATTRS \ - __attribute__((__always_inline__, __nodebug__, __target__("mmx,no-evex512"), \ - __min_vector_width__(64))) +#define __DEFAULT_FN_ATTRS_SSE2 __attribute__((__always_inline__, __nodebug__, __target__("sse2,no-evex512"), __min_vector_width__(64))) phoebewang wrote: Don't need explicit `_SSE2`? https://github.com/llvm/llvm-project/pull/96540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Remove mmx 3dnow (PR #96246)
https://github.com/phoebewang commented: This is much like what we have removed for KNL intrinsics/instructions., so general LGTM. But I'd like Simon to sign off given I'm not familar with 3DNOW instructions. https://github.com/llvm/llvm-project/pull/96246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for __outbyte/word/dword and __inbyte/word/dword (PR #93774)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for __outbyte/word/dword and __inbyte/word/dword (PR #93774)
@@ -330,24 +330,35 @@ static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } -static inline int _inp(unsigned short port) { - int ret; +static inline unsigned char __inbyte(unsigned short port) { + unsigned char ret; __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); phoebewang wrote: Seems we prefer to `__volatile__` more? https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for __outbyte/word/dword and __inbyte/word/dword (PR #93774)
https://github.com/phoebewang commented: LGTM. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for __outbyte/word/dword and __inbyte/word/dword (PR #93774)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -348,6 +348,20 @@ static inline unsigned long _inpd(unsigned short port) { return ret; } +static inline int _outp(unsigned short port, int data) { phoebewang wrote: Can we change it to `__outbyte` instead? https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -63,6 +63,91 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] +// +// CHECK-I386-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { +// CHECK-I386-NEXT: [[ENTRY:.*:]] +// CHECK-I386-NEXT:tail call void asm sideeffect "outb ${0:b}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 [[DATA]], i16 [[PORT]]) #[[ATTR3:[0-9]+]], !srcloc [[META4:![0-9]+]] +// CHECK-I386-NEXT:ret i32 [[DATA]] +// +// CHECK-X64-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-X64-SAME: i16 noundef [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] { +// CHECK-X64-NEXT: [[ENTRY:.*:]] +// CHECK-X64-NEXT:tail call void asm sideeffect "outb ${0:b}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 [[DATA]], i16 [[PORT]]) #[[ATTR5:[0-9]+]], !srcloc [[META3:![0-9]+]] +// CHECK-X64-NEXT:ret i32 [[DATA]] phoebewang wrote: Merge this with above and use `CHECK` only. The same for below. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -348,6 +348,20 @@ static inline unsigned long _inpd(unsigned short port) { return ret; } +static inline int _outp(unsigned short port, int data) { + __asm__ volatile("outb %b0, %w1" : : "a"(data), "Nd"(port)); + return data; phoebewang wrote: Return the direct `data` seems useless. Did you check if MSVC returns the same value or it actually reads from the port and returns the old data? https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -63,6 +63,91 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] +// +// CHECK-I386-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { +// CHECK-I386-NEXT: [[ENTRY:.*:]] phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -63,6 +63,91 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] +// +// CHECK-I386-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { +// CHECK-I386-NEXT: [[ENTRY:.*:]] +// CHECK-I386-NEXT:tail call void asm sideeffect "outb ${0:b}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 [[DATA]], i16 [[PORT]]) #[[ATTR3:[0-9]+]], !srcloc [[META4:![0-9]+]] +// CHECK-I386-NEXT:ret i32 [[DATA]] phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -63,6 +63,91 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] +// +// CHECK-I386-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { +// CHECK-I386-NEXT: [[ENTRY:.*:]] +// CHECK-I386-NEXT:tail call void asm sideeffect "outb ${0:b}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 [[DATA]], i16 [[PORT]]) #[[ATTR3:[0-9]+]], !srcloc [[META4:![0-9]+]] phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -63,6 +63,91 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] +// +// CHECK-I386-LABEL: define dso_local noundef i32 @test_outp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]], i32 noundef returned [[DATA:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { phoebewang wrote: The `PORT`, `DATA` and `ATTR2` are not necessary. You can just remove the whole line. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
https://github.com/phoebewang approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Revert "[X86] Add support for MS inp functions." (PR #95890)
https://github.com/phoebewang approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/95890 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
@@ -5,15 +5,15 @@ // NO_GHASH-NOT: "-gcodeview-ghash" // default -// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s +// RUN: %clang_cl -target x86_64-windows /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s // enabled -// RUN: %clang_cl /Z7 -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s +// RUN: %clang_cl -target x86_64-windows /Z7 -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s // disabled -// RUN: %clang_cl /Z7 -gcodeview-ghash -gno-codeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s +// RUN: %clang_cl -target x86_64-windows /Z7 -gcodeview-ghash -gno-codeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s // enabled, no /Z7 -// RUN: %clang_cl -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s +// RUN: %clang_cl -target x86_64-windows -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s // GCC-style driver -// RUN: %clang -g -gcodeview -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s -// RUN: %clang -g -gcodeview -gcodeview-ghash -gno-codeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s +// RUN: %clang -target x86_64-windows -g -gcodeview -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s phoebewang wrote: Not only clang driver, but also clang-cl. The root cause is many target don't set BinFormat to COFF on Windows. This probably because they don't support Windows at all, but we need to exclude them to run this test to avoid the unused-command-line-argument warning. https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
@@ -298,15 +298,15 @@ // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s +// RUN: %clang_cl -target x86_64-windows /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s phoebewang wrote: Yes, the key is `x86_64` here, but I feel safe to add the `windows` together :) https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
https://github.com/phoebewang approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -329,6 +329,25 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static inline int _inp(unsigned short port) { + int ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); phoebewang wrote: I have a check, they are still required. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -329,6 +329,25 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static inline int _inp(unsigned short port) { + int ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); phoebewang wrote: I took a look at the Clang code, it seems these `b`, `w` modifiers are only meaningful to ARM/AArch64. We don't need them for X86 assembly. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -329,6 +329,28 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static inline int _inp(unsigned short port) { + int ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +static inline unsigned short _inpw(unsigned short port) { + unsigned short ret; + __asm__ volatile("inw %w1, %w0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +static inline unsigned long _inpd(unsigned short port) { + unsigned long ret; + __asm__ volatile("inl %w1, %k0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +#define inp(port) _inp((port)) +#define inpw(port) _inpw((port)) phoebewang wrote: >From MSVC doc: > The inp and inpw names are older, deprecated names for the _inp and _inpw > functions. Maybe we don't need to provide them now. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -63,6 +63,47 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] + +int test_inp(unsigned short port) { + return _inp(port); +} +// CHECK-LABEL: i32 @test_inp(i16 noundef +// CHECK-SAME: [[PORT:%.*]]) +// CHECK: [[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-NEXT: ret i32 [[TMP0]] + +unsigned short test_inpw(unsigned short port) { + return _inpw(port); +} +// CHECK-LABEL: i16 @test_inpw(i16 noundef +// CHECK-SAME: [[PORT:%.*]]) +// CHECK: [[TMP0:%.*]] = tail call i16 asm sideeffect "inw ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-NEXT: ret i16 [[TMP0]] + +unsigned long test_inpd(unsigned short port) { + return _inpd(port); +} +// CHECK-LABEL: i32 @test_inpd(i16 noundef +// CHECK-SAME: [[PORT:%.*]]) +// CHECK: [[TMP0:%.*]] = tail call i32 asm sideeffect "inl ${1:k}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) phoebewang wrote: Shouldn't it be `={eax}` for 32-bit? https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -329,6 +329,28 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static inline int _inp(unsigned short port) { + int ret; + __asm__ volatile("inb %b1, %b0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +static inline unsigned short _inpw(unsigned short port) { + unsigned short ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +static inline unsigned long _inpd(unsigned short port) { + unsigned long ret; + __asm__ volatile("inb %k1, %b0" : "=a"(ret) : "Nd"(port)); phoebewang wrote: `inl` https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -329,6 +329,28 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static inline int _inp(unsigned short port) { + int ret; + __asm__ volatile("inb %b1, %b0" : "=a"(ret) : "Nd"(port)); + return ret; +} + +static inline unsigned short _inpw(unsigned short port) { + unsigned short ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port)); phoebewang wrote: You need `inw` here. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -63,6 +63,82 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] + +int test_inp(unsigned short port) { + return _inp(port); +} +// CHECK-I386-LABEL: define dso_local i32 @test_inp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]]) +// CHECK-I386-NEXT: entry: +// CHECK-I386-NEXT:[[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-I386-NEXT:ret i32 [[TMP0]] +// +// CHECK-X64-LABEL: define dso_local i32 @test_inp( +// CHECK-X64-SAME: i16 noundef [[PORT:%.*]]) +// CHECK-X64-NEXT: entry: +// CHECK-X64-NEXT:[[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-X64-NEXT:ret i32 [[TMP0]] phoebewang wrote: I think we don't care about zeroext or not here, you can simple check `CHECK-LABEL: define dso_local i32 @test_inp(i16 noundef` and omit the rest. Then you can use CHECK now. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -63,6 +63,82 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] + +int test_inp(unsigned short port) { + return _inp(port); +} +// CHECK-I386-LABEL: define dso_local i32 @test_inp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]]) phoebewang wrote: These can be put in one line now. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86] Add support for MS inp functions. (PR #93804)
@@ -63,6 +63,82 @@ unsigned __int64 test__emulu(unsigned int a, unsigned int b) { // CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]] // CHECK: ret i64 [[RES]] + +int test_inp(unsigned short port) { + return _inp(port); +} +// CHECK-I386-LABEL: define dso_local i32 @test_inp( +// CHECK-I386-SAME: i16 noundef zeroext [[PORT:%.*]]) +// CHECK-I386-NEXT: entry: +// CHECK-I386-NEXT:[[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-I386-NEXT:ret i32 [[TMP0]] +// +// CHECK-X64-LABEL: define dso_local i32 @test_inp( +// CHECK-X64-SAME: i16 noundef [[PORT:%.*]]) +// CHECK-X64-NEXT: entry: +// CHECK-X64-NEXT:[[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) +// CHECK-X64-NEXT:ret i32 [[TMP0]] phoebewang wrote: These can be merged as ``` // CHECK-LABEL: define dso_local i32 @test_inp( // CHECK-SAME: i16 noundef zeroext [[PORT:%.*]]) // CHECK-NEXT: entry: // CHECK-NEXT:[[TMP0:%.*]] = tail call i32 asm sideeffect "inb ${1:b}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 [[PORT]]) // CHECK-NEXT:ret i32 [[TMP0]] ``` The same to others. https://github.com/llvm/llvm-project/pull/93804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -329,6 +329,26 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static __inline__ int __DEFAULT_FN_ATTRS _outp(unsigned short port, int data) { + __asm__ volatile("outb %b0, %w1" : : "a"(data), "Nd"(port) : "memory"); + return data; +} + +static __inline__ unsigned short __DEFAULT_FN_ATTRS +_outpw(unsigned short port, unsigned short data) { + __asm__ volatile("outw %w0, %w1" : : "a"(data), "Nd"(port) : "memory"); + return data; +} + +static __inline__ unsigned long __DEFAULT_FN_ATTRS _outpd(unsigned short port, + unsigned long data) { + __asm__ volatile("outl %k0, %w1" : : "a"(data), "Nd"(port) : "memory"); + return data; +} + +#define outp(port, data) _outp(port, data) +#define outpw(R, D) _outpw(port, data) phoebewang wrote: No outpd? https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86]Add support for _outp{|w|d} (PR #93774)
@@ -329,6 +329,26 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst, static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile("hlt"); } + +static __inline__ int __DEFAULT_FN_ATTRS _outp(unsigned short port, int data) { + __asm__ volatile("outb %b0, %w1" : : "a"(data), "Nd"(port) : "memory"); phoebewang wrote: Instruction doesn't clobber memory. https://github.com/llvm/llvm-project/pull/93774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] Reland "[X86] Remove knl/knm specific ISAs supports (#92883)" (PR #93136)
https://github.com/phoebewang approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/93136 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
phoebewang wrote: LGTM but I'd like @RKSimon to take a second look. https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -8,16 +8,12 @@ target triple = "x86_64-unknown-linux-gnu" define dso_local i32 @main() local_unnamed_addr #0 !dbg !7 { entry: tail call void @llvm.prefetch(ptr inttoptr (i64 291 to ptr), i32 0, i32 0, i32 1), !dbg !9 - tail call void @llvm.x86.avx512.gatherpf.dpd.512(i8 97, <8 x i32> undef, ptr null, i32 1, i32 2), !dbg !10 ret i32 291, !dbg !11 } ; Function Attrs: inaccessiblemem_or_argmemonly nounwind declare void @llvm.prefetch(ptr nocapture readonly, i32, i32, i32) #1 -; Function Attrs: argmemonly nounwind -declare void @llvm.x86.avx512.gatherpf.dpd.512(i8, <8 x i32>, ptr, i32, i32) #2 - attributes #0 = {"target-cpu"="x86-64" "target-features"="+avx512pf,+sse4.2,+ssse3"} phoebewang wrote: Remove `+avx512pf` or the whole `"target-features"="..."` https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -268,30 +268,6 @@ define void @gather_qps(<8 x i64> %ind, <8 x float> %src, ptr %base, ptr %stbuf) ret void } -declare void @llvm.x86.avx512.gatherpf.qps.512(i8, <8 x i64>, ptr , i32, i32); phoebewang wrote: Surprise to see they were working without a avx512pf feature. https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -23,7 +23,7 @@ br i1 %6, label %4, label %5, !llvm.loop !9 } - attributes #0 = { nofree norecurse nosync nounwind uwtable writeonly mustprogress "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+x87,-aes,-avx,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxvnni,-f16c,-fma,-fma4,-gfni,-kl,-pclmul,-sha,-sse,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-widekl,-xop" "tune-cpu"="generic" } + attributes #0 = { nofree norecurse nosync nounwind uwtable writeonly mustprogress "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+x87,-aes,-avx,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxvnni,-f16c,-fma,-fma4,-gfni,-kl,-pclmul,-sha,-sse,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-widekl,-xop" "tune-cpu"="generic" } phoebewang wrote: I think maybe we can do an NFC patch to remove these "target-features"="..." given we have already had "target-cpu"="xxx". https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -1,373 +0,0 @@ -# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py phoebewang wrote: Why removing this? https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -9265,6 +9265,33 @@ multiclass avx512_fp28_s opc, string OpcodeStr,X86VectorVTInfo _, } } +multiclass avx512_fp28_s_ass opc, string OpcodeStr, X86VectorVTInfo _> { + let ExeDomain = _.ExeDomain, hasNoSchedulingInfo = 1 in { + defm r : AVX512_maskable_scalar, Sched<[WriteMove]>; + defm rb : AVX512_maskable_scalar, Sched<[WriteMove]>, EVEX_B; + defm m : AVX512_maskable_scalar, Sched<[WriteMove]>; + } +} + +multiclass avx512_eri_s_ass opc, string OpcodeStr> { + defm SSZ : avx512_fp28_s_ass, + EVEX_CD8<32, CD8VT1>, VEX_LIG, T8, PD, EVEX, ; + defm SDZ : avx512_fp28_s_ass, + EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8, PD, EVEX, ; +} + +defm VRCP28 : avx512_eri_s_ass<0xCB, "vrcp28">; phoebewang wrote: Ok, I recalled we still want the enc/dec support. https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -9325,6 +9345,43 @@ multiclass avx512_fp28_p_sae opc, string OpcodeStr, X86VectorVTInfo _, EVEX_B, Sched<[sched]>; } +multiclass avx512_fp28_p_ass opc, string OpcodeStr, X86VectorVTInfo _> { + let ExeDomain = _.ExeDomain, hasNoSchedulingInfo = 1 in { + defm r : AVX512_maskable, Sched<[WriteMove]>; + + defm m : AVX512_maskable, Sched<[WriteMove]>; + + defm mb : AVX512_maskable, Sched<[WriteMove]>, EVEX_B; + } +} +multiclass avx512_fp28_p_sae_ass opc, string OpcodeStr, X86VectorVTInfo _> { + let ExeDomain = _.ExeDomain, Uses = [MXCSR] in + defm rb : AVX512_maskable, Sched<[WriteMove]>, EVEX_B; +} + +multiclass avx512_eri_ass opc, string OpcodeStr> { + defm PSZ : avx512_fp28_p_ass, + avx512_fp28_p_sae_ass, + T8, PD, EVEX_V512, EVEX_CD8<32, CD8VF>; + defm PDZ : avx512_fp28_p_ass, + avx512_fp28_p_sae_ass, + T8, PD, EVEX_V512, REX_W, EVEX_CD8<64, CD8VF>; +} + +defm VRSQRT28 : avx512_eri_ass<0xCC, "vrsqrt28">, EVEX; phoebewang wrote: ditto. https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
@@ -9265,6 +9265,33 @@ multiclass avx512_fp28_s opc, string OpcodeStr,X86VectorVTInfo _, } } +multiclass avx512_fp28_s_ass opc, string OpcodeStr, X86VectorVTInfo _> { + let ExeDomain = _.ExeDomain, hasNoSchedulingInfo = 1 in { + defm r : AVX512_maskable_scalar, Sched<[WriteMove]>; + defm rb : AVX512_maskable_scalar, Sched<[WriteMove]>, EVEX_B; + defm m : AVX512_maskable_scalar, Sched<[WriteMove]>; + } +} + +multiclass avx512_eri_s_ass opc, string OpcodeStr> { + defm SSZ : avx512_fp28_s_ass, + EVEX_CD8<32, CD8VT1>, VEX_LIG, T8, PD, EVEX, ; + defm SDZ : avx512_fp28_s_ass, + EVEX_CD8<64, CD8VT1>, VEX_LIG, REX_W, T8, PD, EVEX, ; +} + +defm VRCP28 : avx512_eri_s_ass<0xCB, "vrcp28">; phoebewang wrote: Why still keep these instructions? https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [polly] [X86] Remove knl/knm specific ISAs supports (PR #92883)
phoebewang wrote: Please note it in release notes. https://github.com/llvm/llvm-project/pull/92883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
@@ -41,6 +41,22 @@ typedef long long __m512i_u __attribute__((__vector_size__(64), __aligned__(1))) typedef unsigned char __mmask8; typedef unsigned short __mmask16; +#ifdef __cplusplus +typedef bool __vecmask2 __attribute__((__ext_vector_type__(2))); +typedef bool __vecmask4 __attribute__((__ext_vector_type__(4))); +typedef bool __vecmask8 __attribute__((__ext_vector_type__(8))); +typedef bool __vecmask16 __attribute__((__ext_vector_type__(16))); +typedef bool __vecmask32 __attribute__((__ext_vector_type__(32))); +typedef bool __vecmask64 __attribute__((__ext_vector_type__(64))); +#else +typedef _Bool __vecmask2 __attribute__((__ext_vector_type__(2))); phoebewang wrote: I'm a bit concerning about the ABI when people abuse them in function call. https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
@@ -77,9 +77,9 @@ _mm512_cvtne2ps_pbh(__m512 __A, __m512 __B) { ///conversion of __B, and higher 256 bits come from conversion of __A. static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_mask_cvtne2ps_pbh(__m512bh __W, __mmask32 __U, __m512 __A, __m512 __B) { - return (__m512bh)__builtin_ia32_selectpbf_512((__mmask32)__U, -(__v32bf)_mm512_cvtne2ps_pbh(__A, __B), -(__v32bf)__W); + return (__m512bh)__builtin_selectvector( + (__v32bf)_mm512_cvtne2ps_pbh(__A, __B), (__v32bf)__W, + __builtin_bit_cast(__vecmask32, __U)); phoebewang wrote: Can we use (__vecmask32) dirctly like `__v32bf` etc? https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
@@ -41,6 +41,22 @@ typedef long long __m512i_u __attribute__((__vector_size__(64), __aligned__(1))) typedef unsigned char __mmask8; typedef unsigned short __mmask16; +#ifdef __cplusplus +typedef bool __vecmask2 __attribute__((__ext_vector_type__(2))); +typedef bool __vecmask4 __attribute__((__ext_vector_type__(4))); phoebewang wrote: We used `__mmask8` for `v2i1` and `v4i1` too. I don't we can bitcast them directly. https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
@@ -3019,6 +3019,26 @@ C-style cast applied to each element of the first argument. Query for this feature with ``__has_builtin(__builtin_convertvector)``. +``__builtin_selectvector`` +-- + +``__builtin_selectvector`` is used to express generic vector element selection. + +**Signature**: + +.. code-block:: c++ + + template + simd_vec __builtin_selectvector(simd_vec lhs, simd_vec rhs, +simd_vec cond) phoebewang wrote: Maybe put `cond` the first operand to match with `select` and the old X86 builtins? https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
@@ -3744,6 +3744,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_selectvector: { +return RValue::get(Builder.CreateSelect(EmitScalarExpr(E->getArg(2)), phoebewang wrote: Should we check all one (or all zero) like we did in `EmitX86Select`? https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: > @phoebewang Can you add a release note for this on the PR for the release > branch and then add the release:note label. Done. https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
phoebewang wrote: Ping? https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/91846 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: > You'll be probably building 18.1.6 with 18.1.5... and that's when you'll > notice the issue. I'm just about finished building 18.1.5 with your patch. So > hopefully all those issues will be gone. I'll report back Okay... This is a combined problem which I never thought before. Sorry for the inconvenience! https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: @FireBurn Sorry, I just noticed #91719. The above comments were based on the issue #91076. I didn't look at the source, but the command line doesn't have an AVX512 option. So I'm assuming the code may related function multi-versioning with manually specified target attributes regarding to AVX512 features. The reason is the same as #91719, but the scenarios may be more common in practice. The defect in previous patch does expose a known issue with the design of EVEX512, which we have noted in https://clang.llvm.org/docs/UsersManual.html#x86 In a word, when user uses target attributes with AVX512 features, they should add an explicit `evex512` or `no-evex512` for robustness since LLVM 18. Missing it may result in some unexpected codegen or error in some corner case. https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: > @tstellar Can a note be added somewhere about this? Folks upgrading to > llvm-18.1.6 will get errors unless they drop -march=native if they were on > 18.1.5 Although I agree we should add a note, I don't think this patch affects much. The problem only coccurs when combining `-march=native` with AVX512 options on a non AVX512 target. This actually is not a valid scenario. The compiled binary will contain AVX512 instruction which crashes it on the target. It violates the intention of using `-march=native`. I also don't see where the error from with 18.1.6. If there were errors, it should come from 18.1.5. https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)
@@ -792,7 +792,7 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState , return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, /*ByVal=*/false, State); +return getIndirectResult(Ty, IsVectorCall && Ty->isBuiltinType(), State); phoebewang wrote: Done. https://github.com/llvm/llvm-project/pull/91846 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/91846 >From 844fb5283d654d7d9cb68c5712b338f0a70b384e Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sat, 11 May 2024 16:07:00 +0800 Subject: [PATCH 1/2] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted This is how MSVC handles it. https://godbolt.org/z/fG386bjnf --- clang/lib/CodeGen/Targets/X86.cpp | 2 +- clang/test/CodeGen/vectorcall.c | 16 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp index 717a27fc9c574..5c09339bd7137 100644 --- a/clang/lib/CodeGen/Targets/X86.cpp +++ b/clang/lib/CodeGen/Targets/X86.cpp @@ -792,7 +792,7 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState , return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, /*ByVal=*/false, State); +return getIndirectResult(Ty, IsVectorCall && Ty->isBuiltinType(), State); } if (isAggregateTypeForABI(Ty)) { diff --git a/clang/test/CodeGen/vectorcall.c b/clang/test/CodeGen/vectorcall.c index cb53ecc70351d..97a532a9e3a25 100644 --- a/clang/test/CodeGen/vectorcall.c +++ b/clang/test/CodeGen/vectorcall.c @@ -140,4 +140,20 @@ void __vectorcall vectorcall_indirect_vec( // X86-SAME: ptr inreg noundef %0, // X86-SAME: i32 inreg noundef %edx, // X86-SAME: ptr noundef %1) + +void __vectorcall vectorcall_indirect_fp( +double xmm0, double xmm1, double xmm2, double xmm3, double xmm4, +v4f32 xmm5, v4f32 ecx, int edx, double mem) { +} + +// X86: define dso_local x86_vectorcallcc void @"\01vectorcall_indirect_fp@@{{[0-9]+}}" +// X86-SAME: (double inreg noundef %xmm0, +// X86-SAME: double inreg noundef %xmm1, +// X86-SAME: double inreg noundef %xmm2, +// X86-SAME: double inreg noundef %xmm3, +// X86-SAME: double inreg noundef %xmm4, +// X86-SAME: <4 x float> inreg noundef %xmm5, +// X86-SAME: ptr inreg noundef %0, +// X86-SAME: i32 inreg noundef %edx, +// X86-SAME: ptr noundef byval(double) align 4 %1) #endif >From ec8be6b7ae2c85a1cab580de24883794eaef8027 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sun, 12 May 2024 13:57:39 +0800 Subject: [PATCH 2/2] Address review comment --- clang/lib/CodeGen/Targets/X86.cpp | 4 +++- clang/test/CodeGen/vectorcall.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp index 5c09339bd7137..29d98aad8fcb4 100644 --- a/clang/lib/CodeGen/Targets/X86.cpp +++ b/clang/lib/CodeGen/Targets/X86.cpp @@ -792,7 +792,9 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState , return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, IsVectorCall && Ty->isBuiltinType(), State); +if (IsVectorCall && Ty->isBuiltinType()) + return ABIArgInfo::getDirect(); +return getIndirectResult(Ty, /*ByVal=*/false, State); } if (isAggregateTypeForABI(Ty)) { diff --git a/clang/test/CodeGen/vectorcall.c b/clang/test/CodeGen/vectorcall.c index 97a532a9e3a25..71dc3b0b9585a 100644 --- a/clang/test/CodeGen/vectorcall.c +++ b/clang/test/CodeGen/vectorcall.c @@ -155,5 +155,5 @@ void __vectorcall vectorcall_indirect_fp( // X86-SAME: <4 x float> inreg noundef %xmm5, // X86-SAME: ptr inreg noundef %0, // X86-SAME: i32 inreg noundef %edx, -// X86-SAME: ptr noundef byval(double) align 4 %1) +// X86-SAME: double noundef %mem) #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)
https://github.com/phoebewang created https://github.com/llvm/llvm-project/pull/91846 This is how MSVC handles it. https://godbolt.org/z/fG386bjnf >From 844fb5283d654d7d9cb68c5712b338f0a70b384e Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sat, 11 May 2024 16:07:00 +0800 Subject: [PATCH] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted This is how MSVC handles it. https://godbolt.org/z/fG386bjnf --- clang/lib/CodeGen/Targets/X86.cpp | 2 +- clang/test/CodeGen/vectorcall.c | 16 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp index 717a27fc9c574..5c09339bd7137 100644 --- a/clang/lib/CodeGen/Targets/X86.cpp +++ b/clang/lib/CodeGen/Targets/X86.cpp @@ -792,7 +792,7 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState , return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, /*ByVal=*/false, State); +return getIndirectResult(Ty, IsVectorCall && Ty->isBuiltinType(), State); } if (isAggregateTypeForABI(Ty)) { diff --git a/clang/test/CodeGen/vectorcall.c b/clang/test/CodeGen/vectorcall.c index cb53ecc70351d..97a532a9e3a25 100644 --- a/clang/test/CodeGen/vectorcall.c +++ b/clang/test/CodeGen/vectorcall.c @@ -140,4 +140,20 @@ void __vectorcall vectorcall_indirect_vec( // X86-SAME: ptr inreg noundef %0, // X86-SAME: i32 inreg noundef %edx, // X86-SAME: ptr noundef %1) + +void __vectorcall vectorcall_indirect_fp( +double xmm0, double xmm1, double xmm2, double xmm3, double xmm4, +v4f32 xmm5, v4f32 ecx, int edx, double mem) { +} + +// X86: define dso_local x86_vectorcallcc void @"\01vectorcall_indirect_fp@@{{[0-9]+}}" +// X86-SAME: (double inreg noundef %xmm0, +// X86-SAME: double inreg noundef %xmm1, +// X86-SAME: double inreg noundef %xmm2, +// X86-SAME: double inreg noundef %xmm3, +// X86-SAME: double inreg noundef %xmm4, +// X86-SAME: <4 x float> inreg noundef %xmm5, +// X86-SAME: ptr inreg noundef %0, +// X86-SAME: i32 inreg noundef %edx, +// X86-SAME: ptr noundef byval(double) align 4 %1) #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/87f3407856e61a73798af4e41b28bc33b5bf4ce6 https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
https://github.com/phoebewang milestoned https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
phoebewang wrote: > Could you make getHostCPUFeatures only write the Features["evex512"] entry if > Features["avx512f"] is true? Instead of copying Features["avx512f"]? Good idea, done. https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/91694 >From 6ea15aa0ee6726cad8dccff10155f058afa0f013 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Fri, 10 May 2024 11:21:41 +0800 Subject: [PATCH 1/2] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 Users want `-march=sandybridge -mavx512f -mavx512vl` behaves the same as `-march=native -mavx512f -mavx512vl` on a sandybridge target. Fixes: #91076 --- clang/lib/Driver/ToolChains/Arch/X86.cpp | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index 53e26a9f8e229..c6d97ef4e971a 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -132,10 +132,14 @@ void x86::getX86TargetFeatures(const Driver , const llvm::Triple , if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) { if (StringRef(A->getValue()) == "native") { llvm::StringMap HostFeatures; - if (llvm::sys::getHostCPUFeatures(HostFeatures)) -for (auto : HostFeatures) + if (llvm::sys::getHostCPUFeatures(HostFeatures)) { +for (auto : HostFeatures) { + if (!F.second && F.first() == "evex512") +continue; Features.push_back( Args.MakeArgString((F.second ? "+" : "-") + F.first())); +} + } } } >From d50ae3b317839f5603b091aa029414b3c3c42259 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Fri, 10 May 2024 12:02:09 +0800 Subject: [PATCH 2/2] Address review comment --- clang/lib/Driver/ToolChains/Arch/X86.cpp | 8 ++-- llvm/lib/TargetParser/Host.cpp | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index c6d97ef4e971a..53e26a9f8e229 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -132,14 +132,10 @@ void x86::getX86TargetFeatures(const Driver , const llvm::Triple , if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) { if (StringRef(A->getValue()) == "native") { llvm::StringMap HostFeatures; - if (llvm::sys::getHostCPUFeatures(HostFeatures)) { -for (auto : HostFeatures) { - if (!F.second && F.first() == "evex512") -continue; + if (llvm::sys::getHostCPUFeatures(HostFeatures)) +for (auto : HostFeatures) Features.push_back( Args.MakeArgString((F.second ? "+" : "-") + F.first())); -} - } } } diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp index 834f4536f93ac..c5156c6cb802c 100644 --- a/llvm/lib/TargetParser/Host.cpp +++ b/llvm/lib/TargetParser/Host.cpp @@ -1802,7 +1802,8 @@ bool sys::getHostCPUFeatures(StringMap ) { Features["rtm"]= HasLeaf7 && ((EBX >> 11) & 1); // AVX512 is only supported if the OS supports the context save for it. Features["avx512f"]= HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save; - Features["evex512"]= Features["avx512f"]; + if (Features["avx512f"]) +Features["evex512"] = true; Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save; Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1); Features["adx"]= HasLeaf7 && ((EBX >> 19) & 1); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (PR #91694)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/91694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][Driver] Do not add `-evex512` for `-march=native` when the targ… (PR #91694)
https://github.com/phoebewang created https://github.com/llvm/llvm-project/pull/91694 …et doesn't support AVX512 Users want `-march=sandybridge -mavx512f -mavx512vl` behaves the same as `-march=native -mavx512f -mavx512vl` on a sandybridge target. Fixes: #91076 >From 6ea15aa0ee6726cad8dccff10155f058afa0f013 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Fri, 10 May 2024 11:21:41 +0800 Subject: [PATCH] [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 Users want `-march=sandybridge -mavx512f -mavx512vl` behaves the same as `-march=native -mavx512f -mavx512vl` on a sandybridge target. Fixes: #91076 --- clang/lib/Driver/ToolChains/Arch/X86.cpp | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index 53e26a9f8e229..c6d97ef4e971a 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -132,10 +132,14 @@ void x86::getX86TargetFeatures(const Driver , const llvm::Triple , if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ)) { if (StringRef(A->getValue()) == "native") { llvm::StringMap HostFeatures; - if (llvm::sys::getHostCPUFeatures(HostFeatures)) -for (auto : HostFeatures) + if (llvm::sys::getHostCPUFeatures(HostFeatures)) { +for (auto : HostFeatures) { + if (!F.second && F.first() == "evex512") +continue; Features.push_back( Args.MakeArgString((F.second ? "+" : "-") + F.first())); +} + } } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][CFE] Support EGPR in inline assembly. (PR #91323)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/91323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][CFE] Support EGPR in inline assembly. (PR #91323)
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +egpr %s -o /dev/null + +int foo(void) { + register int a __asm__("ebx"); +#ifdef __EGPR__ phoebewang wrote: Why just use `#ifdef __arm__` to distinguish ARM from X86? https://github.com/llvm/llvm-project/pull/91323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang reopened https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
phoebewang wrote: > For driver tests we prefer specifying a concrete target triple than making a > test dependent on the default target triple (controlled by `REQUIES: > coff-supported-target` in this case). > > A concrete target triple (e.g. x86_64-windows) loses coverage for > aarch64-windows, but we generally accept the loss. Thanks for the suggestion, updated. https://github.com/llvm/llvm-project/pull/88245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format", second try (PR #88245)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/88245 >From 569c7dfee58f7e4357d8af45b52a3135cb4e2e65 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 15:38:49 +0800 Subject: [PATCH 1/3] "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" (#87987)", second try This reverts commit 299b636a8f1c9cb2382f9dce4cdf6ec6330a79c6. --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Driver/gcodeview-command-line.c | 1 + clang/test/Misc/win32-elf.c| 5 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3950a8ed38e8b4 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatMachO() - ? llvm::codegenoptions::DIF_DWARF - : llvm::codegenoptions::DIF_CodeView; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/test/Driver/gcodeview-command-line.c b/clang/test/Driver/gcodeview-command-line.c index da8708af322480..83542fc71aece4 100644 --- a/clang/test/Driver/gcodeview-command-line.c +++ b/clang/test/Driver/gcodeview-command-line.c @@ -1,5 +1,6 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target // ON-NOT: "-gno-codview-commandline" // OFF: "-gno-codeview-command-line" diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c new file mode 100644 index 00..f75281dc418727 --- /dev/null +++ b/clang/test/Misc/win32-elf.c @@ -0,0 +1,5 @@ +// Check that basic use of win32-elf targets works. +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s + +// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO +// DEBUG-INFO: -dwarf-version={{.*}} >From e6a326dc4b21f8180e03d9f2157fd63792a1dc14 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Wed, 10 Apr 2024 17:02:23 +0800 Subject: [PATCH 2/3] Move codeview related tests to gcodeview-command-line.c --- clang/test/Driver/cl-options.c | 12 -- clang/test/Driver/cl-outputs.c | 12 -- clang/test/Driver/gcodeview-command-line.c | 26 +- clang/test/Driver/gcodeview-ghash.c| 1 + clang/test/lit.cfg.py | 2 ++ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 5b6dfe308a76ea..202f7a50e618fe 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -545,18 +545,6 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" -// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s -// Zi: "-gcodeview" -// Zi: "-debug-info-kind=constructor" - -// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s -// Z7: "-gcodeview" -// Z7: "-debug-info-kind=constructor" - -// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s -// ZGMLT: "-gcodeview" -// ZGMLT: "-debug-info-kind=line-tables-only" - // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s // BreproDefault: "-mincremental-linker-compatible" diff --git a/clang/test/Driver/cl-outputs.c b/clang/test/Driver/cl-outputs.c index 4d58f0fb548b57..10bd0c97dcdca8 100644 --- a/clang/test/Driver/cl-outputs.c +++ b/clang/test/Driver/cl-outputs.c @@ -294,15 +294,3 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" // FioRACE2: "-o" "foo.x" - -// RUN: %clang_cl /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=ABSOLUTE_OBJPATH %s -// ABSOLUTE_OBJPATH: "-object-file-name={{.*}}a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s -// RELATIVE_OBJPATH1: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s -// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj" - -// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s -//
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
phoebewang wrote: > I am curious what a `win32-elf` triple is. Does MSVC support generating ELF > object files? No idea, but https://github.com/llvm/llvm-project/issues/87140 doesn't look like from fuzzing. Consider Windows has WSL now, I'd not surprise it's supported or will be supported someday, see https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2?view=msvc-170 https://github.com/llvm/llvm-project/pull/87149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (PR #89446)
phoebewang wrote: Sorry, I know nothing about it. But it looks to me it's to match with GCC, why don't borrow the value from GCC as a beginning? https://github.com/llvm/llvm-project/pull/89446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests, NFC (PR #88736)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests, NFC (PR #88736)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests (PR #88736)
https://github.com/phoebewang approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests (PR #88736)
@@ -1,13 +1,22 @@ // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=return %s | FileCheck %s --check-prefix=RETURN // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=branch %s | FileCheck %s --check-prefix=BRANCH // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=full %s | FileCheck %s --check-prefix=FULL +// RUN: %clang_cc1 -E -triple=x86_64 -dM -o - -fcf-protection=none %s | FileCheck %s --check-prefix=NOTCET // RUN: not %clang_cc1 -emit-llvm-only -triple i386 -target-cpu pentium-mmx -fcf-protection=branch %s 2>&1 | FileCheck %s --check-prefix=NOCFPROT +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=return %s -emit-llvm | FileCheck %s --check-prefix=CFPROTR +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=branch %s -emit-llvm | FileCheck %s --check-prefix=CFPROTB +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=full %s -emit-llvm | FileCheck %s --check-prefix=CFPROTF phoebewang wrote: ```suggestion // RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=return %s -emit-llvm | FileCheck %s --check-prefixes=CFPROTR,CFPROTNONE // RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=branch %s -emit-llvm | FileCheck %s --check-prefixes=CFPROTB,CFPROTNONE // RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=full %s -emit-llvm | FileCheck %s --check-prefixes=CFPROTR,CFPROTB,CFPROTNONE ``` https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests (PR #88736)
@@ -1,13 +1,22 @@ // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=return %s | FileCheck %s --check-prefix=RETURN // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=branch %s | FileCheck %s --check-prefix=BRANCH // RUN: %clang_cc1 -E -triple i386 -dM -o - -fcf-protection=full %s | FileCheck %s --check-prefix=FULL +// RUN: %clang_cc1 -E -triple=x86_64 -dM -o - -fcf-protection=none %s | FileCheck %s --check-prefix=NOTCET // RUN: not %clang_cc1 -emit-llvm-only -triple i386 -target-cpu pentium-mmx -fcf-protection=branch %s 2>&1 | FileCheck %s --check-prefix=NOCFPROT +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=return %s -emit-llvm | FileCheck %s --check-prefix=CFPROTR +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=branch %s -emit-llvm | FileCheck %s --check-prefix=CFPROTB +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=full %s -emit-llvm | FileCheck %s --check-prefix=CFPROTF +// RUN: %clang_cc1 -triple=x86_64 -o - -fcf-protection=none %s -emit-llvm | FileCheck %s --check-prefix=CFPROTNONE // RETURN: #define __CET__ 2 // BRANCH: #define __CET__ 1 // FULL: #define __CET__ 3 -// CFPROT: !{i32 8, !"cf-protection-branch", i32 1} - +// NOTCET-NOT: #define __CET__ // NOCFPROT: error: option 'cf-protection=branch' cannot be specified on this target +// CFPROTR: !{i32 8, !"cf-protection-return", i32 1} +// CFPROTB: !{i32 8, !"cf-protection-branch", i32 1} +// CFPROTF: !{i32 8, !"cf-protection-return", i32 1} +// CFPROTF-NEXT: !{i32 8, !"cf-protection-branch", i32 1} phoebewang wrote: ```suggestion // CFPROTNONE-NOT: cf-protection- // CFPROTR: !{i32 8, !"cf-protection-return", i32 1} // CFPROTB: !{i32 8, !"cf-protection-branch", i32 1} // CFPROTNONE-NOT: cf-protection- ``` https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [SEH] Ignore async exception flag when the environment is not MSVC (PR #88101)
phoebewang wrote: Thanks a lot @nico! I see the bot is still red, but not failed on this test any more. https://github.com/llvm/llvm-project/pull/88101 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [SEH] Ignore async exception flag when the environment is not MSVC (PR #88101)
https://github.com/phoebewang closed https://github.com/llvm/llvm-project/pull/88101 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests (PR #88736)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [X86][test] Added extra cet tests (PR #88736)
https://github.com/phoebewang edited https://github.com/llvm/llvm-project/pull/88736 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits