Wednesday, 24 May 2017

How to replace all %0,%1,%2,%3 to %{{[0-9]+}} in vim?


 (a)Select the text you want to replace.
 (b) :%s#%[0-4]#%{{[0-9]+}}#gc
 It is just one key.

 before:
 // CHECK-LABEL: xxsldwi_should_not_assert
// CHECK:  bitcast <2 x double> %0 to <4 x i32>
// CHECK-NEXT:  bitcast <2 x double> %1 to <4 x i32>
// CHECK-NEXT:  shufflevector <4 x i32> %2, <4 x i32> %3, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
// CHECK-NEXT:  bitcast <4 x i32> %4 to <2 x double>
after:
// CHECK-LABEL: xxsldwi_should_not_assert
// CHECK:  bitcast <2 x double> %{{[0-9]+}} to <4 x i32>
// CHECK-NEXT:  bitcast <2 x double> %{{[0-9]+}} to <4 x i32>
// CHECK-NEXT:  shufflevector <4 x i32> %{{[0-9]+}}, <4 x i32> %{{[0-9]+}}, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
// CHECK-NEXT:  bitcast <4 x i32> %{{[0-9]+}} to <2 x double>

No comments:

Post a Comment