2013-06-07 5 views
23

アドバンスドベクトル拡張(AVX)で、_m256_cmp_psのような比較命令を使用する場合、最後の引数は比較述語です。 述語の選択肢が私に圧倒されます。 彼らはタイプ、注文、シグナリングの三重であるようです。 など。 _CMP_LE_OSは 'より小さいか等しい、順序付けられた、シグナリングです。AVX比較述語バリアントを選択する方法

最初に、信号または非シグナリングを選択するパフォーマンス理由はありますか? 同様に、順序付けされていないか、順不同ですか?

「非シグナル伝達」とはどういう意味ですか? これはドキュメントではまったく見つかりません。 何を選択すればいいのですか?ここで

は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

「NaN」に遭遇しない場合は、実際には関係ありません。 –

答えて

21

What does ordered/unordered comparison mean?を参照)オペランドの一方がNaNが含まれている場合は、比較が真であるかどうかに関係しています。シグナリング(S)と非シグナリング(Qが静かな場合)は、オペランドにNaNが含まれている場合に例外が発生するかどうかを決定します。

パフォーマンスの観点から、これらはすべて同じである必要があります(例外は発生しないものとします)。 NaNがあるときに警告したい場合は、シグナリングが必要です。順序付けられていないものと順序付けられていないものは、どれもNaNをどのように処理するかによって異なります。

関連する問題