@@ -14,13 +14,15 @@ func TestSub(t *testing.T) {
1414 registers .GPRegisterX3 ,
1515 registers .GPRegisterX4 ,
1616 registers .GPRegisterX5 ,
17+ immediates .DoNotSetFlags ,
1718 ))
1819
1920 // SUB X27, X26, X25
2021 AssertExpectedInstruction (t , "sub x27, x26, x25" , instructions .SUB (
2122 registers .GPRegisterX27 ,
2223 registers .GPRegisterX26 ,
2324 registers .GPRegisterX25 ,
25+ immediates .DoNotSetFlags ,
2426 ))
2527}
2628
@@ -30,27 +32,31 @@ func TestSubWithXZR(t *testing.T) {
3032 registers .GPRegisterXZR ,
3133 registers .GPRegisterX4 ,
3234 registers .GPRegisterX5 ,
35+ immediates .DoNotSetFlags ,
3336 ))
3437
3538 // Test SUB with XZR as first source
3639 AssertExpectedInstruction (t , "sub x3, xzr, x5" , instructions .SUB (
3740 registers .GPRegisterX3 ,
3841 registers .GPRegisterXZR ,
3942 registers .GPRegisterX5 ,
43+ immediates .DoNotSetFlags ,
4044 ))
4145
4246 // Test SUB with XZR as second source
4347 AssertExpectedInstruction (t , "sub x3, x4, xzr" , instructions .SUB (
4448 registers .GPRegisterX3 ,
4549 registers .GPRegisterX4 ,
4650 registers .GPRegisterXZR ,
51+ immediates .DoNotSetFlags ,
4752 ))
4853
4954 // Multiple XZR registers
5055 AssertExpectedInstruction (t , "sub xzr, xzr, xzr" , instructions .SUB (
5156 registers .GPRegisterXZR ,
5257 registers .GPRegisterXZR ,
5358 registers .GPRegisterXZR ,
59+ immediates .DoNotSetFlags ,
5460 ))
5561}
5662
@@ -69,3 +75,19 @@ func TestSubImm(t *testing.T) {
6975 immediates .Immediate12 (1000 ),
7076 ))
7177}
78+
79+ func TestSubDoSetFlags (t * testing.T ) {
80+ AssertExpectedInstruction (t , "subs x0, x1, x2" , instructions .SUB (
81+ registers .GPRegisterX0 ,
82+ registers .GPRegisterX1 ,
83+ registers .GPRegisterX2 ,
84+ immediates .DoSetFlags ,
85+ ))
86+
87+ AssertExpectedInstruction (t , "subs xzr, x30, x29" , instructions .SUB (
88+ registers .GPRegisterXZR ,
89+ registers .GPRegisterX30 ,
90+ registers .GPRegisterX29 ,
91+ immediates .DoSetFlags ,
92+ ))
93+ }
0 commit comments