2013-06-07 30 views
23

Trong phần mở rộng Vector nâng cao (AVX) các chỉ dẫn so sánh như _m256_cmp_ps, đối số cuối cùng là một biến vị ngữ so sánh. Các lựa chọn cho vị ngữ áp đảo tôi. Dường như chúng là một loại tripple của loại, đặt hàng, báo hiệu. Ví dụ: _CMP_LE_OS nhỏ hơn hoặc bằng, đặt hàng, báo hiệu.Cách chọn AVX so sánh biến vị ngữ

Đối với người mới bắt đầu, có lý do hiệu suất để chọn tín hiệu hoặc không báo hiệu, và tương tự, được đặt hàng hoặc sắp xếp không nhanh hơn người kia?

Và 'không báo hiệu' có nghĩa là gì? Tôi không thể tìm thấy điều này trong tài liệu. Bất kỳ quy tắc nào khi chọn nội dung nào?

Dưới đây là những lựa chọn vị từ avxintrin.h:

/* Compare */ 
#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */ 
#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */ 
#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */ 
#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */ 
#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */ 
#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */ 
#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */ 
#define _CMP_ORD_Q 0x07 /* Ordered (nonsignaling) */ 
#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */ 
#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unord, signaling) */ 
#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */ 
#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */ 
#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */ 
#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */ 
#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */ 
#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */ 
#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */ 
#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */ 
#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */ 
#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */ 
#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */ 
#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */ 
#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unord, non-signaling) */ 
#define _CMP_ORD_S 0x17 /* Ordered (signaling) */ 
#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */ 
#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unord, non-sign) */ 
#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */ 
#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */ 
#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */ 
#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */ 
#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */ 
#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */ 
+0

Nếu bạn sẽ không gặp phải 'NaN' thì điều đó thực sự không quan trọng. –

Trả lời

21

Ordered vs Unordered đã làm với liệu so sánh là đúng nếu một trong các toán hạng chứa một NaN (xem What does ordered/unordered comparison mean?). Tín hiệu (S) và không báo hiệu (Q cho yên tĩnh?) Sẽ xác định liệu một ngoại lệ được nâng lên nếu một toán hạng chứa một NaN.

Từ góc nhìn hiệu suất, tất cả những điều này đều giống nhau (giả sử tất nhiên không có trường hợp ngoại lệ nào được nêu ra). Nếu bạn muốn được cảnh báo khi có NaN, thì bạn muốn báo hiệu. Đối với đơn đặt hàng vs không có thứ tự, tất cả phụ thuộc vào cách bạn muốn đối phó với NaN.

Các vấn đề liên quan